function week(date,n) {
            var checkDate = StringToDate(date);
            checkDate.setDate(checkDate.getDate() + n - (checkDate.getDay() || 7));
           return checkDate;
        }

date:日期

n:想要返回周几,例如:周一:1,周二:2,周三:3

返回值:返回一个日期

 

下面的方法是返回当前日期所在周的周一对应的日期

function getMon(date) {
            var checkDate = StringToDate(date);
            checkDate.setDate(checkDate.getDate() + 1 - (checkDate.getDay() || 7));
           return checkDate;
        }

相关文章:

  • 2021-07-05
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2021-08-14
  • 2022-01-28
  • 2022-01-12
  • 2018-05-12
相关资源
相似解决方案