Firefox:
new Date("2013-07-23 12:00:00").toString()
new Date("2013-07-23T12:00:00").toString()
new Date("2013-07-23T12:00:00Z").toString()
new Date("2013/07/23 12:00:00").toString()
Chrome:
new Date("2013-07-23 12:00:00").toString()
new Date("2013-07-23T12:00:00").toString()
new Date("2013-07-23T12:00:00Z").toString()
new Date("2013/07/23 12:00:00").toString()
. , Chrome :
new Date("2013-07-23 00:00:00").toString()
new Date("2013-07-23").toString()
If you need to parse dates from strings sequentially, you should use a library like moment.js .
moment("2013-07-23 12:00:00", "YYYY-MM-DD HH:mm:ss").format()
moment.utc("2013-07-23 12:00:00", "YYYY-MM-DD HH:mm:ss").format()
The main advantage is that you can control the input and output formats, and it works the same in all browsers.
source
share