其他分享
首页 > 其他分享> > 判断两个时间是否超过90天

判断两个时间是否超过90天

作者:互联网

// JS获取两个日期之间相差的天数
function getDaysBetween(dateString1, dateString2) {
  var startDate = Date.parse(dateString1)
  var endDate = Date.parse(dateString2)
  var days = (endDate - startDate) / (1 * 24 * 60 * 60 * 1000)
  // alert(days);
  return days
}

// 日期格式化 function formatDate(cellValue) { if (cellValue === null || cellValue === '') return '' var date = new Date(cellValue) var year = date.getFullYear() var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() return year + '-' + month + '-' + day }

  

标签:判断,是否,Date,var,getMonth,date,90,cellValue,getDate
来源: https://www.cnblogs.com/hwy6/p/15342983.html