These docs are for v1.0. Click to read the latest docs for v1.2.

DATE

Creates a date from the specified values.

Syntax

=DATE(year)

=DATE(year, month)

=DATE(year, month, day)

=DATE(year, month, day, hours)

=DATE(year, month, day, hours, minutes)

=DATE(year, month, day, hours, minutes, seconds)

=DATE(year, month, day, hours, minutes, seconds, milliseconds)

=DATE(year, month, day, hours, minutes, seconds, milliseconds, offset)

Arguments

ArgumentTypeDescription
yearNumberThe year for the new date
monthNumber(Optional) The month for the new date, defaults to 1 (January)
dayNumber(Optional) The day for the new date, defaults to 1
hoursNumber(Optional) The hours for the new date, defaults to 0 (midnight)
minutesNumber(Optional) The minutes for the new date, defaults to 0
secondsNumber(Optional) The seconds for the new date, defaults to 0
millisecondsNumber(Optional) The milliseconds for the new date, defaults to 0
offsetNumber(Optional) The timezone offset for the new date, in minutes, defaults to the browser's current timezone offset

Examples

In the following examples, the current browser has a timezone offset of -7 hours. For more information about offsets see UTC Offset.

=DATE(2020)2020-01-01 00:00:00.000
Create a date with the year 2020, and defaults for all other values with the current browser timezone

=DATE(2020, 2)2020-02-01 00:00:00.000
Create a date with the year 2020, the month 2, and defaults for all other values with the current browser timezone

=DATE(2020, 2, 3)2020-02-03 00:00:00.000
Create a date with the year 2020, the month 2, the day 3, and defaults for all other values with the current browser timezone

=DATE(2020, 2, 3, 4)2020-02-03 04:00:00.000
Create a date with the year 2020, the month 2, the day 3, the hours 4, and defaults for all other values with the current browser timezone

=DATE(2020, 2, 3, 4, 5)2020-02-03 04:05:00.000
Create a date with the year 2020, the month 2, the day 3, the hours 4, the minutes 5, and defaults for all other values with the current browser timezone

=DATE(2020, 2, 3, 4, 5, 6)2020-02-03 04:05:06.000
Create a date with the year 2020, the month 2, the day 3, the hours 4, the minutes 5, the seconds 6, and defaults for all other values with the current browser timezone

=DATE(2020, 2, 3, 4, 5, 6, 7)2020-02-03 04:05:06.007
Create a date with the year 2020, the month 2, the day 3, the hours 4, the minutes 5, the seconds 6, the milliseconds 7, with the current browser timezone

=DATE(2020, 2, 3, 4, 5, 6, 7, -720)2020-02-03 09:05:06.007
Create a date with the year 2020, the month 2, the day 3, the hours 4, the minutes 5, the seconds 6, the milliseconds 7, with the timezone offset of -720 (a -12 hours offset)