Skip to content
AlertaChartAlertaScript / docs
AlertaScript / alerta.timestamp
On this pageSignatureParametersReturnsExample

Metadata / Reference

alerta.timestamp

TradingView-compatible spelling: timestamp, runs without warnings

Builds a timestamp (milliseconds since the Unix epoch). Three forms: from date/time components, read on the chart symbol's exchange clock (`syminfo.timezone` — UTC on crypto charts, New York time on a US stock); with an IANA timezone as the first argument, which reads those components in that zone instead; or from a single DATE STRING — `timestamp("2024-01-01")`, `timestamp("2024-01-01 09:30")`, `timestamp("2026-08-01T11:00:00-0500")`. A date string without its own offset is read as UTC.

alerta.timestamp(year, month, day, hour, minute, second) | timestamp(timezone, year, month, day, …) | timestamp(dateString) → int

Parameters

NameTypeRequiredDefaultDescription
yearint or stringYes—Year — or, in the other two forms, an IANA timezone followed by the date components, or a whole date string on its own.
monthintNo—Month 1..12. Omitted in the date-string form.
dayintNo—Day of month. Omitted in the date-string form.
hourintNo—Hour.
minuteintNo—Minute.
secondintNo—Second.

Returns

int

Example

alerta.timestamp
t = timestamp(2026, 4, 10, 12, 0, 0)fromText = timestamp("2026-04-10 12:00")plot(t == fromText ? 1 : 0, { title: "same instant", pane: "oscillator" })

Names and aliases

Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.

AlertaScript

No results found.

Search by name, alias, or keyword.