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

后端 未结 8 1410
情话喂你
情话喂你 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:18

    These strtotime inputs work very well:

    strtotime( "next monday" );
    strtotime( "previous monday" );
    strtotime( "today" );
    strtotime( "next friday" );
    strtotime( "previous friday" );
    

    All you need to do is to wrap the logic inside some if statements.

提交回复
热议问题