1. 获取从今天算起,几天后的日期 function GetDateStr(AddDayCount) { var dd = new Date(); dd.setDate(dd.getDate() + AddDayCount);//获取AddDayCount天后的日期 var y = dd.getFullYear(); var m = dd.getMonth() + 1;//获取当前月份的日期 var d = dd.getDate(); return y + "-" + m + &quo
var now = new Date(); //当前日期 var nowDayOfWeek = (now.getDay() == 0) ? 7 : now.getDay() - 1; //今天是本周的第几天.周一=0,周日=6 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月值(1月=0,12月=11) var nowMonReal = now.getMonth() + 1; //当前月实际数字 var
/** * 针对时间的工具类 */ var DateTimeUtil = function () { /*** * 获得当前时间 */ this.getCurrentDate = function () { return new Date(); }; /*** * 获得本周起止时间 */ this.getCurrentWeek = function () { //起止日期数组 var startStop = new Array(); //获取当前时间 var currentDate = this
/** * 获取本周.本季度.本月.上月的开始日期.结束日期 */ var now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getY
效果: 代码: //用于获取日期本周.本月.本季度的js //Author : guanghe //文件引用方法:<script src="${staticPath}/common/js/dateUtil.js"></script> /** * 获取本周.本季度.本月.上月的开始日期.结束日期 */ var now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDa
js 获取 本周.上周.本月.上月.本季度.上季度的开始结束日期 /** * 获取本周.本季度.本月.上月的开始日期.结束日期 */ var now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天本周的第几天 var nowDay = now.getDate(); //当前日 var nowMonth = now.getMonth(); //当前月 var nowYear = now.getYear(); //当前年 no