简体   繁体   中英

how to convert this string “09-March-2018” into Unix timestamp in javascript?

var stardate = "02-March-2016";

How to convert the stardate string into UNIX timestamp. Is there is any inbuilt function in javascript for this?

To get the unix-timestamp do this:

new Date("02-March-2016").getTime() / 1000;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM