This article mainly introduces the PHP method for calculating the start and end dates of the week where the specified date is located. it involves php's date and time operations and has some reference value, you can refer to the following example to describe how PHP calculates the start and end dates of the week of the specified date. Share it with you for your reference. The specific implementation method is as follows:
Calculates the end date of a week.<? Php $ time = $ _ POST [year]. '-'. $ _ POST [month]. '-'. $ _ POST [day]. '00:00:00 '; echo ('the time you entered is :'. $ time.'
'); $ Lastday = date ("Y-m-d", strtotime ("$ time Sunday"); echo ('input time day of the week is :'. date ("Y-m-d", strtotime ("$ lastday-6 days ")).'
'); Echo ('the last day of the input time is:'. $ lastday);?>
I hope this article will help you with php programming.