Skip to content

Bars Specification 0.1.0 — Transform: as_date_time

Category: datetime · Since: 0.1.0

Converts a numeric epoch timestamp to a date-time.

Interprets the numeric input as an epoch timestamp in unit ("milliseconds" by default, or "seconds") and produces kBars's date-time value kind, distinct from a number or a string. A non-numeric input is a soft failure yielding null.

Input coercion: number

Arguments

Name Type Optional Default
unit string yes "milliseconds"

Arity: 0–1

Worked examples

{{ ts | as_date_time }}

1970-01-01T00:00:02Z
{{ ts | as_date_time: 'seconds' }}

1970-01-01T00:00:05Z

Full fixture: transforms/transform-as_date_time.json