1

我正在寻找一种在 jquery 中获取时间戳的方法,就像我们在 php by 中那样time()(这是自 1970 年 1 月 1 日以来的秒数)。

我试过event.timeStamp了,但它输出以 9 开​​头的 9 位数字,我知道这是不正确的。

4

2 回答 2

8

使用 jquery.now() http://jsbin.com/icesab/edit#javascript,html

于 2012-04-30T21:12:29.043 回答
3

试试这个:

Math.floor(+new Date() / 1000)
于 2012-04-30T21:12:00.300 回答