PHP Get start date and end date of this week, PHP start date
This example describes how PHP gets the start date and end date for this week. Share to everyone for your reference. Specific as follows:
Copy the Code Code as follows://Current date
$sdefaultDate = Date ("y-m-d");
$first =1 represents a start date of Monday for every Sunday for a start date of 0
$first = 1;
Gets the first day of the current week Sunday is 0 weeks a to Saturday is 1-6
$w =date (' W ', Strtotime ($sdefaultDate));
Gets the start date of the week, if $w is 0, then represents Sunday, minus 6 days
$week _start=date (' y-m-d ', Strtotime ("$sdefaultDate-". $w? $w-$first: 6). ' Days ');
End of week date
$week _end=date (' y-m-d ', Strtotime ("$week _start +6 Days");
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/965351.html www.bkjia.com true http://www.bkjia.com/PHPjc/965351.html techarticle PHP Get start date and end date of this week, PHP start date This example describes how PHP gets the start date and end date for this week. Share to everyone for your reference. Specific ...