DATE

Takes a date, represented by a string, an integer, or a DATE_PARSE object, and returns a formatted string representation.

The output format is defined in ruby strftime (Time) syntax.

Optionally, the output timezone can be specified with values from the tz database.

Natural language parsing is handled by chronic. When it receives ambiguous dates, ie "01/02/2023", it will default to the EU format (DD/MM/YYYY). Combine with DATE_PARSE to explicitly define the format.

Syntax 

DATE(date, format, timezone)

Usage examples 

Example 1

Formula

DATE("2022-07-17", "%a, %b %d, %y")

Output

"Fri, Jul 17, 21"

Example 2

Formula

DATE("2021-07-17", "%Y")

Output

"2021"

Example 3

Takes DATE_PARSE objects

Formula

DATE(DATE_PARSE("05/04/1994", "%d/%m/%Y"), "%B %e, %Y")

Output

"April 5, 1994"

Example 4

Many different representations of dates are supported

Formula

DATE("March 17, 2021", "%b %d, %y")

Output

"Mar 17, 21"

Example 5

Natural language dates are supported. See chronic for more examples.

Formula

DATE("fourteenth of May 2024", "%Y-%m-%d")

Output

"2024-05-14"

Example 6

Relative times are supported. See chronic for more examples.

Formula

DATE("tomorrow at 10am", "%Y-%m-%d %H:%M:%S")

Output

"2023-05-22 10:00:00"

Example 7

Unix timestamps are supported

Formula

DATE(1647712411, "%Y-%m-%dT%H:%M:%S")

Output

"2022-03-19T17:53:31"

Example 8

Unix timestamps with 13+ digits are treated as milliseconds

Formula

DATE(1687450077063, "%Y-%m-%dT%H:%M:%S.%L")

Output

"2023-06-22T16:07:57.063"

Example 9

To get the current time, pass the keyword "now" (or "today")

Formula

DATE("now", "%Y-%m-%d %H:%M")

Output

"2022-03-11 16:24"

Example 10

Defaults to iso8601 format with three decimal places if no format is provided

Formula

DATE("now")

Output

"2022-03-11T16:24:01.123Z"

Example 11

Takes optional timezone argument

Formula

DATE("2023-05-19 12pm", "%Y-%m-%d %H:%M:%S %Z", "Asia/Tokyo")

Output

"2023-05-19 21:00:00 JST"

Sample Actions 

Transform
DATE
Transform
My Action

Select an action to inspect.

You can also click "Copy actions" and paste them in your Tines story to see how they work.

Was this helpful?