Skip to content

Bars Specification 0.1.0 — Transform: format_date_time

Category: datetime · Since: 0.1.0

Formats a date-time value to a string.

Formats a date-time input to a string using format ("iso8601"/"rfc3339" by default; also accepts "rfc1123"/"rfc2822", or any kotlinx.datetime Unicode format pattern such as "yyyy-MM-dd") and zone (an IANA/TimeZone.of-recognized zone id, "UTC" by default). An unrecognized zone id is a soft failure yielding null.

Input coercion: date_time

Arguments

Name Type Optional Default
format string yes "iso8601"
zone string yes "UTC"

Arity: 0–2

Worked examples

{{ ts | as_date_time: 'seconds' | format_date_time }}

1970-01-01T00:00:02Z
{{ ts | as_date_time: 'seconds' | format_date_time: 'iso8601' 'UTC-05:00' }}

1969-12-31T19:00:00-05:00

Full fixture: transforms/transform-format_date_time.json