makeDate Function

Top  Previous  Next

Builds a date/time value from components such as year, month, day, etc.


DateTime.makeDate(year, month, day [, hour [, min [, sec]]])


yearAn integer in the range 1980 - 2099 specifying the year.
monthAn integer in the range 0 - 11 specifying the month. Note that 0 = January -- month numbers are one less than common notation.
dayAn integer in the range 1 - 31 specifying the day of the month. This day must be valid for the specified month.
hourAn optional integer in the range 0 - 23 specifying the hour; zero if omitted.
minAn optional integer in the range 0 - 59 specifying the minute; zero if omitted.
secAn optional integer in the range 0 - 59 specifying the second; zero if omitted.

Return Value

If all arguments are valid, an integer that is the date/time value for the given date; otherwise, NaN (not a number).


If the entire time is omitted, zero is used which is equivalent to midnight.


DateTime.makeDate(2012, 4, 20)// May 20, 2012 midnight
DateTime.makeDate(2012, 3, 31)// NaN - too many days for April
DateTime.makeDate(2011,0,1,5,0,8)// January 1, 2011 5:00:08 AM