Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找一种在 jquery 中获取时间戳的方法,就像我们在 php by 中那样time()(这是自 1970 年 1 月 1 日以来的秒数)。
time()
我试过event.timeStamp了,但它输出以 9 开头的 9 位数字,我知道这是不正确的。
event.timeStamp
使用 jquery.now() http://jsbin.com/icesab/edit#javascript,html
试试这个:
Math.floor(+new Date() / 1000)