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 stringParameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
time | series int | Yes | — | UNIX time in milliseconds. |
format | series string | No | — | Pattern, default "yyyy-MM-dd'T'HH:mm:ssZ". |
timezone | series string | No | — | IANA timezone, "UTC" or "GMT±N". Defaults to syminfo.timezone. |
Returns
series stringExample
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.