由于最近在研究轻交互式web设计,所以整理了下面的东东,仅供分享测试学习交流之用。
JavaScript 获取当前时间戳:
第一种方法:
var timestamp
= Date.parse(new Date());
结果:1280977330000
第二种方法:
var
timestamp = (new Date()).valueOf();
结果:1280977330748
第三种方法:
var
timestamp=new Date().getTime();
结果:1280977330748
第一种:获取的时间戳是把毫秒改成000显示,
第二种和第三种是获取了当前毫秒的时间戳。
源地址:http://laf.miid.cn/js/js-method-of-getting-current-timestamp.html