How PHP calculates the start and end dates for the week of the specified date
This article mainly introduces PHP to calculate the start and end date of the week of the specified date, involving PHP operation date and time skills, with a certain reference value, the need for friends can refer to the following
This example describes how PHP calculates the start and end dates for the week in which a specified date is located. Share to everyone for your reference. The implementation method is as follows:
?
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21st
22
23
24
25
26
27
28
29 |
Calculate a week start end date
$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 (' The first day of the week entered is: '. Date ("Y-m-d", Strtotime ("$lastday-6 Days"). '
');
Echo (' Input time of Week last day is: '. $lastday);
?>
|
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/973119.html www.bkjia.com true http://www.bkjia.com/PHPjc/973119.html techarticle PHP calculates the start and end date of the week of the specified date this article mainly introduces the method of PHP to calculate the start and end date of the week of the specified date, involving PHP operation date Time ...