JS计算日期相减天数

//计算日期相减天数
function DateMinus(sDate){
  var sdate = new Date(sDate.replace(/-/g, "/"));
  var now = new Date();
  var days = now.getTime() - sdate.getTime();
  var day = parseInt(days / (1000 * 60 * 60 * 24));
  return day;
}

posted on 2017-02-22 16:03  虞政博  阅读(27294)  评论(0)    收藏  举报

导航