Calculating milliseconds from epoch
鉴于我有:mm,dd,yy,hh:mm,am / pm,推荐/最简单的方法是将数据从时代转换为毫秒。
Another technique (which most browsers support, as well as NodeJS) that doesn't require having to instantiate a Date object
var nowEpoch = Date.now();
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
new Date("some string").getTime()
You can get the milliseconds from epoch with +new Date('date string') .
jsFiddle.
The + operator implicitly calls valueOf() which returns the same as getTime() .
下一篇: 从纪元计算毫秒
