new Date() is working in Chrome but not Firefox
new Date() is working in Chrome but not Firefox
This is the way of instantiate a date object. Try this code example,
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)
Try this also,
d1 = new Date("October 13, 1975 11:13:00") d2 = new Date(79,5,24) d3 = new Date(79,5,24,11,33,0)
The source is here. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
The EMCAScript specification need the exact one date format.But it custom date formats may be freely supported by an implementation: “In case the String are not confirm to that format the function may fall back to any implementation-specific heuristics .The implementation-specific date format are different in chrome and FF.
Here is the code,
new Date('2001-01-31 12:00:00')
And here is the format: YYYY-MM-DDTHH:mm:ss.sss.
Anyone can use this code, because it works at all browsers,
new Date('2001/01/31 12:00:00')
This should be the format,
“yyyy/MM/dd HH:mm:ss”.