how to convert a string to a Unix timestamp in javascript?

后端 未结 4 1523
一生所求
一生所求 2020-12-01 12:14

I want to convert a string \"2013-09-05 15:34:00\" into a Unix timestamp in javascript. Can any one tell how to do that? thanks.

4条回答
  •  暖寄归人
    2020-12-01 12:33

    For this you should check out the moment.s-library

    Using that you could write something like:

    newUnixTimeStamp = moment('2013-09-05 15:34:00', 'YYYY-MM-DD HH:mm:ss').unix();
    

提交回复
热议问题