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

后端 未结 10 1504
误落风尘
误落风尘 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:34

      I think the only problem with your coding is TimeZone.
    

    Solution:
    Set your own time Zone. Here is the example of my own time zone:

    Example

       date_default_timezone_set('Asia/Kolkata');
    
    
       Set the above line before calling any time function.
    

    Have a nice day.

提交回复
热议问题