The Date()
function returns a date with the given year, month and day.
Syntax
Date(year, month, day)
Date(year, month, day, hour, minute)
Date(year, month, day, hour, minute, second)
Returns
A new date value.
Returns an unknown value if one the parameters is unknown or outside the common date boundaries.
Parameters
year
– a number that is the year unitmonth
– a number that is the month unitday
– a number that is the day unithour
– a number that is the time hour unitminute
– a number that is the time minute unitsecond
– a number that is the time second unit
Examples
Date(2017, 5, 31)
/* Returns '2017-5-31' */
Date(2017, 5, 31, 16, 27)
/* Returns '2017-5-31T16:27:00' */