Text to Date

Create a date and time from the contents of a text string to a specified format.

For most standard formats, this function isn't necessary. You can pass any standard date and time text string into a date input to have it converted automatically. This function is for non-standard or ambiguous formats, for example, if the value is 2/1, that might be read as 1-Feb or 2-Jan.

Input

Field Definition Type Required

start

Text to be converted to a date and time value.

Text

TRUE

format

Date format code of the input value for the start field.

Text

FALSE

Output

Field Definition Type

output

Date object that corresponds to the start input value based on the specified format code.

Date & Time

Format Codes

Build the format for the date or time format that you want. Use any combination of these codes along with fixed characters, such as slashes and commas.

format codes output

D

For a day number (in the month), or use DD to always display the day using two digits.

M

For a single month number, or use MM to use two digits.

MMM

For a three letter month abbreviation, or use MMMM for the full month name.

Y

For a four-digit year number, or use YY for a two-digit year number.

h

For the hour number (1-12), or use hh to use two digits.

H

For the hour number (0-23), or use HH to use two digits.

mm

For the minutes.

ss

For the seconds. Add an .S to include milliseconds, for example, ss.SSS.

a

For am or pm designation, or use A for AM or PM.

Z

For the time zone in offset format, for example, -07:00. You can also use z for code, for example, PDT.

d

For the day of the week, where 1 is Monday. Use ddd for an abbreviated day format, for example, Mon. Use dddd for the full day name, for example, Monday.

x

For a time stamp in "unix in milliseconds" format. This is defined as the count of milliseconds since Jan 1, 1970 at midnight GMT.

X

For a time stamp in "unix in seconds" format, also known as the "epoch" or "unix timestamp". This is defined as the count of seconds since Jan 1, 1970 at midnight GMT.

Examples

start format output

1/2/2016

D/M/Y

2016-02-01T00:00:00.000Z

1/2/16

M/D/YY

2016-01-02T00:00:00.000Z

1493053116

X

2017-04-24T16:58:36.000Z

Related topics

Functions

Workflow elements