What is the best way to retrieve the dates for last Monday and Friday

前端 未结 4 1855
南方客
南方客 2020-12-31 10:23

I need to get the dates for Monday and Friday last week. To do this, i am getting the date of Monday this week and subtracting 7 days. This gives me the date for Monday last

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-31 11:30

    The only thing I see wrong is that you are in fact testing the range Mo-Fr, and not, as stated, retrieving two specific days. It would be safer to test range Mo-Sa with exclusive upper bound.

提交回复
热议问题