var myDate = new Date();
var epoch = myDate.getTime(); //1318023197289 number of ms since epoch
var unixEpoch = Math.round(epoch/1000)
epoch
back to a Date object? var date = new Date(1318023197289);
并且,由于unixEpoch只是epoch / 1000,因此您可以将构造函数中的参数乘以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.