DATE

DATE takes a year, month, and day as integers and returns a date object. Use coerce.to-integer or coerce-to-string convert the results to seconds or a date as a string, respectively. The structure of the date response returned follows the ISO 8601 standard.

+ / - operations can be used with the DATE function, such as DATE() - 3600 or DATE() + 600.

Function category: Date

Syntax

DATE(arg1, arg2, arg3)

Arguments

Description

arg1

Integer representing the year.

arg2

Integer representing the month.

arg3

Integer representing the day.

imestamp formats

Using the coercion functions with the DATE() function formats the timestamp as either seconds or data/time formats.

UNIX timestamp milliseconds

The base result for DATE() is in milliseconds.

DATE(2020, 08, 19)
#
# results in a date in milliseconds
#
[
"LocalDate",
1597795200000
]

UNIX timestamp seconds

Adding coerce.to-integer to DATE() results in a timestamp in seconds.

coerce.to-integer(DATE(2020, 08, 19))
#
# results in a timestamp in seconds
#
1597795200

ISO 8601 Date Time format

Adding coerce.to-string to DATE() results in a ISO 8601 date/time format.

coerce.to-string(DATE(2020, 08, 19))
#
# results in YYYY-MM-DD
#
"2020-08-19"