Get date for monday and friday for the current week (PHP)

后端 未结 8 1407
情话喂你
情话喂你 2020-12-01 03:46

How can I get the date for monday and friday for the current week?

I have the following code, but it fails if current day is sunday or saturday.

$cu         


        
8条回答
  •  旧巷少年郎
    2020-12-01 04:15

    i use :

    $first_week_date = date('d F Y', strtotime('next Monday -1 week', strtotime('this sunday')));
    $last_week_date = date('d F Y', strtotime('next Monday -1 week + 4 days', strtotime('this sunday')));
    

提交回复
热议问题