Date Class — current time and structured support for date information
new Date( ) new Date(milliseconds) new Date(year, month, day, hours, minutes, seconds, ms)
The number of milliseconds between the new date and midnight of January 1, 1970 UTC (Coordinated Universal Time, akin to GMT). Positive if after; negative if before. Any required local time zone adjustment is made after the date in UTC time is determined. For example, specifying a
millisecondsargument of 1000 in Eastern Standard Time would create a date 1 second past midnight on January 1, 1970 in UTC time, which translates to 7:00:01 p.m. on December 31, 1969 in EST time (5 hours behind UTC time).
An integer specifying the year. Required when using the
msconstructor format. If
yearis one or two digits, it is treated as the number of years since 1900 (e.g., a
yearof 11 always refers to the year 1911, not 2011). Use four-digit numbers to specify year 2000 or later (e.g., use 2010, not 10). Three-digit years are treated as pre-1000 A.D. Note that when
yearis negative or less than 800, the calculation is unreliable. To specify dates prior to 1000 A.D., it’s safest to use the single
An integer specifying the month, from ( January) to 11 (December), not from 1 to 12. Required when using the
msconstructor format. Out-of-range months are carried over to the next or previous year. For example, a
monthof 13 is ...