Convert

Converts a date and time to a variety of formats.

Input Fields

  • start: (required) a date & time text in ISO format or a date & time object will automatically convert, as will many common date & time text formats.

  • format - (optional) a date format code that indicates how to display the date and/or time, such as "M/D/Y" to get a result like "9/7/2016" or "hh:mm a" for a time like "09:05 am" (see Date to Text) for information on using format codes)

  • zone - (optional) a "TZ" time zone such as "US/Pacific" or "Europe/Paris" (see full list on wikipedia).

Output Fields

  • date - the date & time object the corresponds to the start text. (Note: This is often unnecessary as date & time input fields will automatically convert date & time text.)

  • iso - the full date and time in ISO date format but without fractional seconds, using UTC “Z” notation (e.g. “2016-09-07T16:55:25Z”)

  • epoch - as standard in many systems, this converts the start date & time to the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds.

  • unix - similar to epoch, but the total number of milliseconds since January 1, 1970.

  • human - a human readable date & time, but not adjusted for local time zone.

  • custom - the text of the date in the format specified by the format and zone input fields.

Note: The input fields format and zone work only with the output field custom. See the Date to Text function for details and examples of how to generate custom formatted dates and times as text. Using the custom output field is equivalent to using the Date To Text function.

Example

If the start is "2016-09-07T00:01:25.670Z" then:

  • date is 2016-09-07T00:01:25.670Z

  • iso is "2016-09-07T00:01:25Z"

  • epoch is 1473206485

  • unix is 1473206485670

  • human is "Wed, September 7th at 12:01 AM"

See the Date to Text function for examples for the custom output field. The custom output in combination with the format and zone inputs works the same as Date To Text.

See Also

Functions in Workflows

About the elements of Okta Workflows