Ad blocker detected: Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker on our website.
1 post • Page 1 of 1
Create a new Date object
To create a new Date object use the Date() constructor:
with no arguments - Date() creates a Date instance containing the current time (up to milliseconds) and date.
with one integer argument - Date(m) creates a Date instance containing the time and date corresponding to the Epoch time (1 January, 1970 UTC) plus m milliseconds. Example: new Date(749019369738) gives the date Sun, 26 Sep 1993 04:56:09
with a string argument - Date(dateString) returns the Date object that results after parsing dateString with Date.parse.
Note that these examples were generated on a browser in the Central Time Zone of the US, during Daylight Time, as evidenced by the code. Where comparison with UTC was instructive, Date.prototype.toISOString() was used to show the date and time in UTC (the Z in the formatted string denotes UTC).