If the current date is Tuesday 20160614, the last week's time interval is 20160606-20160612, and the current date is not completed (that is, this week is not completed on Sunday) so last week will always be [20160606]-[20160612]. how can php obtain the current date of the last week's time range? [2016/06/14 Tuesday]
Then the last week's time range is]
Only the current date is not completed (that is, this week is not completed)
So last week we will always be]
How does php obtain the last week's time range?
Reply content:
The current date is [2016/06/14 Tuesday]
Then the last week's time range is]
Only the current date is not completed (that is, this week is not completed)
So last week we will always be]
How does php obtain the last week's time range?
Use strtotime. check the manual for details. Exampledate('Y-m-d', strtotime('-1 week'))Obtain the week before the current time, and the month is alsodate('Y-m-d', strtotime('-1 month')), Day or year.
echo date("Y-m-d",strtotime('-1 week last monday'))." 00:00:00";
echo date("Y-m-d",strtotime('last sunday'))." 23:59:59";
Echo'
Last week start time:
'; Echo date ("Y-m-d H: I: s", mktime (0, 0, 0, date ("m"), date ("d ") -date ("w") + 1-7, date ("Y"), "\ n"; echo date ("Y-m-d H: I: s ", mktime (23,59, 59, date (" m "), date (" d ")-date (" w ") + 7-7, date ("Y"), "\ n ";