如何比较这两个日期呢?
Event Date: May 25, 2015 02:00:00
,第二个日期将是客户端日期,例如:May 20, 2015 05:00:00
我的目标是得到它的差异,把它转换成秒。
var t1 = new Date(2015, 05, 25, 2, 0, 0, 0)
var t2 = new Date(2015, 05, 20, 5, 0, 0, 0)
var diff = t1.getTime() - t2.getTime()
var secondsFromT1ToT2 = diff / 1000;
var secondsBetweenDates = Math.abs(secondsFromT1ToT2);
console.log(secondsBetweenDates)
# 421200