ymd格式,精确到天数差
var s1='2018-5-1';
a1 = new Date(s1.replace(/-/g, "/"));a2 = new Date();//获取当前日期
var day = a2.getTime() - a1.getTime();
var time = parseInt(day / (1000 * 60 * 60 * 24));
alert(time);
ymd格式,精确到天数差
var s1='2018-5-1';
a1 = new Date(s1.replace(/-/g, "/"));var time = parseInt(day / (1000 * 60 * 60 * 24));
alert(time);