将时间格式和时间戳相互组转化

        var stringTime = "2017-11-10";
var timestamp2 = Date.parse(new Date(stringTime));
timestamp2 = timestamp2 / 1000;
console.log(stringTime + "的时间戳为:" + timestamp2);

        var stringTime = "2014-07-10";
var timestamp2 = Date.parse(new Date(stringTime));
timestamp2 = timestamp2 / 1000;
//2014-07-10 10:21:12的时间戳为:1404958872
console.log(stringTime + "的时间戳为:" + timestamp2);


没有更多推荐了,返回首页