js计算两个时间是否大于一个月
来源:互联网 发布:苹果cms忘记登录密码 编辑:程序博客网 时间:2024/04/29 07:56
<script type="text/javascript">//比较两个时间是否大于一个月,例如20170215--到20170315 是一个月,到20170316是大于一个月
function getD(sDate, endDate) {
function getD(sDate, endDate) {
var sDate = new Date(sDate);
var eDate = new Date(endDate);
if (eDate.getFullYear() - sDate.getFullYear() > 0) {//先比较年
return true;
} else if (eDate.getMonth() - sDate.getMonth() > 1) {//再比较月
return true;
} else if (eDate.getMonth() - sDate.getMonth() == 1) {
if (eDate.getDate() - sDate.getDate() >= 1) {
return true;
}
}
return true;
} else if (eDate.getMonth() - sDate.getMonth() > 1) {//再比较月
return true;
} else if (eDate.getMonth() - sDate.getMonth() == 1) {
if (eDate.getDate() - sDate.getDate() >= 1) {
return true;
}
}
return false;
}
var c = getD("2017-11-05", "2017-12-06");
alert(c)
var c = getD("2017-11-05", "2017-12-06");
alert(c)
</script>
阅读全文
0 0
- js计算两个时间是否大于一个月
- js判断时间是否大于当前时间
- js判断两个时间是否相差9个月
- JS判断选择的时间是否大于当前时间
- js判断输入时间是否大于当前时间
- js判断选择时间是否大于当前实际时间
- js判断选择的时间是否大于今天
- js判断选择的时间是否大于今天
- 计算两个时间间隔天数的js
- JS 计算两个时间的时间差
- js计算两个时间点的时间差
- js计算两个时间相差的天数
- js jquery 计算两个时间相差天数
- js 计算两个时间的时间差
- js 计算两个时间的时间差
- JS 判断字符串是否为时间格式&开始时间不能大于截止时间
- 判断时间是否大于一天
- js计算一个月多少天
- 网站优化一般怎么去做?这几个环节至关重要
- 在win7和Linux环境,使用mysql进行数据库的备份和恢复
- ycb的ACM进阶之路(多重背包模板)
- scala修饰符
- [李景山php] ddos 防御基础
- js计算两个时间是否大于一个月
- iOS pop 不走dealloc方法
- 后台使用jeecg模板excel导出,会出现检索字段传入后台乱码的问题
- 分块基础
- SecurityContextPersistenceFilter是如何做到任何对 SecurityContext 的改变都可以被 copy 到 HttpSession。
- 浅谈PHP的构造方法
- centos7.2 get pid by process name with python3.6
- CSS笔记
- Java中堆内存和栈内存详解