Date
The Date
Data Type is used to represent a calendar date, which consists of three sets of numbers representing a year, a month, and a day.
Structure
Date
is an object with the following properties:
day (
number
) - the day of a month, where indexing begins at 1 with Januarymonth (
number
) - the month of a year, where 1 represents January, whereas 12 represents Decemberyear (
number
) - a year
Examples
Dates can be created using the DATE function which takes the year, month, and day as arguments. For example, a Date for September 18th, 2017 can be created by calling the DATE function with the arguments 2017, 9, 18, respectively.
Now, assuming we have an example_date
variable holding the date above, let's use the FORMAT_DATE to format the date into the string "September 18th, 2017":
As with FORMAT_DATETIME, when called with no format string, FORMAT_DATE will generate an ISO 8601 and RFC3339 compatible timestamp. The time portion of the timestamp will be filled with zeros.
Last updated