js时间加减

1.选择上一周方法(不算当天)

 1     $("#weekSel").click(function () {
 2         //当前时间
 3         var now = new Date();
 4         //当前时间往前推一周
 5         now.setDate(now.getDate() - 7);
 6         //当前时间
 7         var yes = new Date();
 8         //当期时间往前推一天
 9         yes.setDate(yes.getDate() - 1);
10         var nowTra = now.Format("yyyy-MM-dd");
11         var yesTra = yes.Format("yyyy-MM-dd");
12       
13     });
选择周方法

猜你喜欢

转载自www.cnblogs.com/Spinoza/p/9140002.html