// 获取两日期间月数
function getMonthBetween(startTime, endTime, sign) {
var startTime = startTime.replace(sign, "");
var endTime = endTime.replace(sign, "");
var startYear = parseInt(startTime.substring(0, 4));
var endYear = parseInt(endTime.substring(0, 4));
var startMonth = parseInt(startTime.substring(4, 6));
var endMonth = parseInt(endTime.substring(4, 6));
// 相差月份
var number = ((endYear * 12 + endMonth) - (startYear * 12 + startMonth));
return (number + 1);
}
js获取两日期间月数差
最新推荐文章于 2024-05-23 17:36:21 发布