首页 > 代码库 > 获取下周一日期javascript

获取下周一日期javascript

var Stamp;
Stamp = new Date();
var num = 7-Stamp.getDay()+1;
Stamp.setDate(Stamp.getDate() + num);

var year = Stamp.getFullYear(); //获取完整的年份(4位,1970-????)
var month = Stamp.getMonth() +1; //获取当前月份(0-11,0代表1月)
var mvar =‘‘;
if(month<10){
mvar = ‘0‘ + month;
}else{
mvar = month+‘‘;
}
var day = Stamp.getDate();
var dvar =‘‘;
if(day<10){
dvar = ‘0‘ + day;
}else{
dvar = day+‘‘;
}
$("input[name=‘wkplan.CYCLE‘]").val(year+"-"+mvar+‘-‘+dvar);

获取下周一日期javascript