The example in this article describes how to get the start date and end date of this week in php. Share it with everyone for your reference. The details are as follows:
The code is as follows:
//Current date
$sdefaultDate = date("Y-m-d");
//$first =1 means every Monday is the starting date, 0 means every Sunday is the starting date
$first=1;
//Get the day of the current week. Sunday is 0, Monday to Saturday is 1 - 6
$w=date('w',strtotime($sdefaultDate));
//Get the start date of this week. If $w is 0, it means Sunday, minus 6 days
$week_start=date('Y-m-d',strtotime("$sdefaultDate -".($w ? $w - $first : 6).' days'));
//End date of this week
$week_end=date('Y-m-d',strtotime("$week_start +6 days"));
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/965531.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/965531.htmlTechArticleHow to get the start date and end date of this week in php This article mainly introduces how to get the start date and end date of this week in php The method of ending date, an example analysis of the skills of operating dates in PHP, has certain...