Convert normal date to unix timestamp

前端 未结 11 953
小鲜肉
小鲜肉 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 06:11

    You can use Date.parse(), but the input formats that it accepts are implementation-dependent. However, if you can convert the date to ISO format (YYYY-MM-DD), most implementations should understand it.

    See Why does Date.parse give incorrect results?.

提交回复
热议问题