Date constructor
Explains the different forms of the date constructor.
The date constructor has four distinct forms.
Syntax | Effect |
---|---|
new Date() | Returns the date representing the current time. |
new Date(milliseconds) | Returns the date representing 00:00:00 UTC, January 1, 1970,
plus Examples:
|
new Date(string) | Returns the date described by month/day/year hour:minute:second msecond The
date expressed in Example:
A date representing December 25th, 1932, at 2:35 PM plus 12 seconds and 820 milliseconds, local time. |
new Date(year, month, [ , day [ , hours [ , minutes [ , seconds [ , mseconds ]]]]]) |
Returns a new date representing the given year, month, day, and so on, taken in local time. The arguments are: year: any integer. month: range 0-11 (where 0=January, 1=February, and so on) day: range 1-31, default 1 hours: range 0-23, default 0 minutes: range 0-59, default 0 seconds: range 0-59, default 0 mseconds: range 0-999, defaults to 0 Examples:
A date representing December 25th, 1932, at 2:35 PM plus 12 seconds and 820 milliseconds, local time.
A date representing December 25th, 1932, at 00:00, local time. |