FormatISO8601DateTime (open)

Formats a datetime in the ISO 8601 format

Syntax

LOADLIB "wh::datetime.whlib";

STRING FUNCTION FormatISO8601DateTime(DATETIME whattime, RECORD options)

Parameters

DATETIME whattime

Time to format, in UTC

RECORD options

Options (this function can also be invoked with dateformat, timeformat, timezone and extended as separate parameters, but this syntax is deprecated)

STRING dateformat

Date precision: "year", "month", "day", "week", "weekday", "yearday", "empty". If unset, defaults to "day"

BOOLEAN extended

Use extended format, e.g. "2001-01-01T12:34:56+01:00" instead of "20010101T123456+0100", defaults to TRUE

STRING timeformat

Time precision: "hours", "minutes", "seconds", "milliseconds", "empty". If unset, defaults to "seconds"

STRING timezone

(optional) timezone to present the time in. If unset, defaults to "UTC"

Return value

STRING

The formatted time

Description

This function will format a datetime according to ISO 8601, as described in http://www.w3.org/TR/NOTE-datetime