js 时间
来源:互联网 发布:mac keynote 模板 编辑:程序博客网 时间:2024/06/06 01:30
<pre name="code" class="javascript">/** *@str1 : 传入的时间1 String类型 *@str2 : 传入的时间2 String类型 * 返回boolean值 */function checkdate(str1,str2){var arr1 = str1.split("-"); var date1 = new Date(arr1[0],parseInt(arr1[1])-1,arr1[2]); <span style="font-family: Arial, Helvetica, sans-serif;">//这种方式可能出错(原因不明)</span><span style="white-space:pre">var date1 = parseInt(str1.replace(/-/g,"").replace(/:/g,""),10);</span> var arr2 = str2.split("-"); var date2 = new Date(arr2[0],parseInt(arr2[1])-1,arr2[2]); //这种方式可能不兼容IE(原因不明) var date2 = parseInt(str2.replace(/-/g,"").replace(/:/g,""),10); //建议这种方式
return date1>date2}
/** *获取N天后的日期 AddDayCount为N */function GetDateStr(AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期 var y = dd.getFullYear(); var m = (dd.getMonth()+1)<10?"0"+(dd.getMonth()+1):(dd.getMonth()+1);//获取当前月份的日期,不足10补0var d = dd.getDate()<10?"0"+dd.getDate():dd.getDate(); //获取当前几号,不足10补0return y+"-"+m+"-"+d; }
0 0
- js时间
- js时间
- 时间js
- JS时间
- js 时间
- js时间
- js时间
- js 时间
- JS时间
- js时间
- js -- 时间
- js 时间
- js 时间
- JS 时间
- js时间
- js 时间
- Js时间
- js-时间
- jQuery EasyUI使用教程之在数据网格中添加搜索功能
- zend framework 分页 Zend_Paginator 分页搜索条件
- postgresql-X2 的优点和缺点
- LeetCode 233 Number of Digit One
- LeetCode Lowest Common Ancestor of a Binary Tree
- js 时间
- java微信公众号开发总结(2)——文本消息处理
- 更新xcode后插件失效解决方法
- TableLayoutPanel删除行
- SQL 基础:Select语句,各种join,union用法
- This application is modifying the autolayout engine from a background thread...
- 10.DNS服务器搭建
- How to deal with the error message "Could not load SAPGUIResources"
- 线程同步——信号量