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

Utilities / Reference

alerta.str.format_time

TradingView-compatible spelling: str.format_time, runs without warnings

Formats a UNIX time (milliseconds) as text with Java date letters: yyyy / yy (year), M / MM / MMM / MMMM (9, 09, Sep, September), d / dd, E / EEEE (Mon, Monday), HH (0–23), hh (1–12), a (AM/PM), k, K, mm, ss, SSS (milliseconds), D (day of year), w (week of year), u (weekday 1–7 from Monday), Z (+0300), XXX (+03:00) and z (EDT); text in single quotes is kept verbatim and '' is a quote. The time is read on the given timezone, or on the exchange clock (syminfo.timezone) when none is given — UTC on crypto charts.

alerta.str.format_time(time, format?, timezone?) → series string

Parameters

NameTypeRequiredDefaultDescription
timeseries intYes—UNIX time in milliseconds.
formatseries stringNo—Pattern, default "yyyy-MM-dd'T'HH:mm:ssZ".
timezoneseries stringNo—IANA timezone, "UTC" or "GMT±N". Defaults to syminfo.timezone.

Returns

series string

Example

alerta.str.format_time
indicator("Bar time", overlay=true)if barstate.islast    label.new(bar_index, high, str.format_time(time, "yyyy-MM-dd HH:mm", "America/New_York"))

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.