Convert normal date to unix timestamp

前端 未结 11 970
小鲜肉
小鲜肉 2020-11-28 05:10

How can I convert normal date 2012.08.10 to unix timestamp in javascript?

Fiddle: http://jsfiddle.net/J2pWj/




I\'ve se

11条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 05:59

    You should check out the moment.js api, it is very easy to use and has lots of built in features.

    I think for your problem, you could use something like this:

    var unixTimestamp = moment('2012.08.10', 'YYYY.MM.DD').unix();
    

提交回复
热议问题