Wilang Documentation1.0.0+4

formatDateTime#

Render an instant in a named date and/or time format.

Available in: math cells, REPL.

Syntax#

formatDateTime(value, format [, timezone])

Arguments and behavior#

Formats: iso (2017-01-14T20:09:50.000Z), date (2017-01-14), time (20:09:50), datetime (2017-01-14 20:09:50), weekday (Saturday), rfc (Sat, 14 Jan 2017 20:09:50 GMT), human (Sat Jan 14 2017 20:09:50 GMT+0000). The value is an instant and carries no timezone of its own, so the timezone argument decides how it is rendered; it defaults to UTC, and "local" or an offset such as "+05:30" are also accepted. The example returns scalar (string).

Example#

Edit the inputs, then use Run or Reset. Changes stay in this example.

Example
formatDateTime(parseDateTime("2017-01-14 20:09:50"), "iso")

Expected result: "2017-01-14T20:09:50.000Z".

See also#

formatTime · parseDateTime · startOf · endOf

All functions · Math guides