day1='2014-03-31 00:00:01';
function get_day(day1,day2){ var s = day1; var dt = Date.parse(s.replace(/-/g,"/")); var day1 = new Date(dt); var s = day2; var dt = Date.parse(s.replace(/-/g,"/")); var day2 = new Date(dt); var date3=day1.getTime()-day2.getTime() //时间差的毫秒数 //计算出相差天数 return Math.floor(date3/(24*3600*1000)) }
原文地址:http://blog.csdn.net/q279838089/article/details/26479857