Date ()
With this, you call a function called Date() . It takes no arguments and returns a string representing the current date and time.
new date ()
With this, you create a new instance of Date.
You can use only the following constructors:
new Date() // current date and time new Date(milliseconds) //milliseconds since 1970/01/01 new Date(dateString) new Date(year, month, day, hours, minutes, seconds, milliseconds)
Thus, using 2010-08-17 12:09:36 as a parameter for the constructor is not allowed.
See w3schools .
EDIT: new Date(dateString) uses one of the following formats:
- "October 13, 1975 11:13:00"
- "October 13, 1975 11:13"
- "October 13, 1975
Topera Aug 17 '10 at 18:41 2010-08-17 18:41
source share