convert iso date to milliseconds in javascript

后端 未结 10 1952
不知归路
不知归路 2020-11-29 00:40

Can I convert iso date to milliseconds? for example I want to convert this iso

2012-02-10T13:19:11+0000

to milliseconds.

Because I

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 01:30

    Another option as of 2017 is to use Date.parse(). MDN's documentation points out, however, that it is unreliable prior to ES5.

    var date = new Date(); // today's date and time in ISO format
    var myDate = Date.parse(date);
    

    See the fiddle for more details.

提交回复
热议问题