js获取时间函数 var myDate = new Date; var year = myDate.getFullYear();//获取当前年 var yue = myDate.getMonth()+1;//获取当前月 var date = myDate.getDate();//获取当前日 var h = myDate.getHours();//获取当前小时数(0-23) var m = myDate.getMinutes();//获取当前分钟数(0-59) var s = myDate.get…
js 获取当前月份 第一天和最后一天 var now = new Date(); //当前日期 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getFullYear(); //当前年 //本月的开始时间 var monthStartDate = new Date(nowYear, nowMonth, 1); //本月的结束时间 var monthEndDate = new Date(nowYear, nowMonth+1, 0);…
function DateUtil(){}/***功能:格式化时间*示例:DateUtil.Format("yyyy/MM/dd","Thu Nov 9 20:30:37 UTC+0800 2006 ");*返回:2006/11/09*/DateUtil.Format=function(fmtCode,date){ var result,d,arr_d; var patrn_now_1=/^y{4}-M{2}-d{2}\sh{2}:m{2}:s{2}$/; var…