PHP: Week starts on Monday, but “monday this week” on a Sunday gets Monday next week

后端 未结 10 1512
误落风尘
误落风尘 2020-12-09 14:43

Here\'s a summary of the issue: On Sundays, strtotime(\'this week\') returns the start of next week.

In PHP, the week seems to start on Monday. But, on

10条回答
  •  余生分开走
    2020-12-09 15:20

    I think instead of trying

    echo date('Y-m-d', strtotime('monday this week', strtotime('last sunday')));
    

    you should try

    echo date('Y-m-d', strtotime('monday last week'));
    

提交回复
热议问题