PHP: How to get Sunday and Saturday given a date input?

后端 未结 10 1739
终归单人心
终归单人心 2020-12-15 12:15

How can I get the Sunday and Saturday of the week given a specific date?

For example:

input: Monday, September 28, 2009

output should be:

10条回答
  •  囚心锁ツ
    2020-12-15 12:27

    You use strtotime() and date():

    
    

    outputs:

    Input: Monday, September 28, 2009
    Output: Sunday, September 27, 2009 12:00 PM - Saturday, October 3, 2009 11:59 AM
    

提交回复
热议问题