本篇文章是对使用Javascript获取距今n天前日期的实现代码进行了详细的分析介绍
需要的朋友参考下
复制代码 代码如下:
function Test(day) {
var today = new Date();
var beforMilliseconds = todaygetTime() * * * day;
var beforday = new Date();
befordaysetTime(beforMilliseconds);
var strYear = befordaygetFullYear();
var strDay = befordaygetDate();
var strMonth = befordaygetMonth() + ;
if (strMonth < ) {
strMonth = "" + strMonth;
}
var strYesterday = strYear + "" + strMonth + "" + strDay;
alert(strYesterday);
}