复制代码代码如下所示:
功能测试(日){
var =新
日期();
无功beformilliseconds = today.gettime()- 1000 * 3600 * 24 *天;
无功beforday =新的日期();
beforday.settime(beformilliseconds);
无功stryear = beforday.getfullyear();
无功strday = beforday.getdate();
无功strmonth = beforday.getmonth()+ 1;
如果(strmonth<10){
strmonth =0+ strmonth;
}
无功stryesterday = stryear +-+ strmonth +-+ strday;
警报(stryesterday);
}