PHP gets days of the week and dates of Monday and next Monday for this week
$today =date ("y-m-d");
echo $today;//You can get the date today. Output 2014-9-29
Define an array first.
$rows =array ("Day", "one", "two", "three", "four", "five", "six");
echo "Today is the Week". $rows [Date ("W")]. "
";
Note the date ("W"), which can be obtained for the number of weeks such as 123, note that 0 is Sunday. The array subscript is starting from 0.
Get a quick date for this week
echo "This week is". Date (' y-m-d ', Strtotime ("This Monday")). "
";//output 2014-9-29, because today is just Monday, so the results are very special, if you are interested, can open tomorrow to try the results are correct
Quick access to the next Monday date
echo "This week is". Date (' y-m-d ', Strtotime ("Next Monday")). "
";//Output 2014-10-6
?>
The ps:strtotime () function resolves the datetime description of any English text to a Unix timestamp.
Enclosed in English for the week: Monday Monday [' M?ndi, ' m?ndei]
Tuesday Tuesday [' Tju:zdi]
Wednesday wednesday[' Wenzdei, ' Wenzdi]
Thursday thursday[' Θ?:zdi]
Friday friday[' Fraidi]
Saturday saturday[' S?t?di]
Sunday sunday[' S?ndi]
http://www.bkjia.com/PHPjc/890206.html www.bkjia.com true http://www.bkjia.com/PHPjc/890206.html techarticle PHP Gets the dates of the days of the week and Monday and next Monday for this week $today =date ("y-m-d"); echo $today;//To get today's date. Output 2014-9-29//define a number first ...