PHP gets the day of the week and the dates corresponding to Monday of this week and next Monday_PHP Tutorial

WBOY
Release: 2016-07-13 10:17:42
Original
1157 people have browsed it

php gets the day of the week and the dates corresponding to Monday of this week and next Monday

$today=date("Y-m-d");

echo $today; //You can get what day it is today. Output2014-9-29

//First define an array.

$rows=array("日","一","二","三","四","五","六");
echo "Today is Sunday".$rows[date("w")]."
";

//Note date("w"), this can get the numerical day of the week such as 123. Note that 0 is Sunday. Array subscripts start from 0.

//Quickly get the date corresponding to this Monday

echo "This Monday is".date('Y-m-d',strtotime("this Monday"))."
"; //Output 2014-9-29. Since today happens to be Monday, the result is quite special. If you are interested, you can open it tomorrow and try to see if the result is correct

//Quickly get the date corresponding to next Monday

echo "This Monday is".date('Y-m-d',strtotime("next Monday"))."
";//Output 2014-10-6

?>

PS: The strtotime() function parses any English text datetime description into a Unix timestamp.

Attached is the English equivalent of the week: Monday Monday ['m?ndi, 'm?ndei]

Tuesday ['tju:zdi]
Wednesday Wednesday['wenzdei, 'wenzdi]

Thursday Thursday['θ?:zdi]

Friday['fraidi]
Saturday['s?t?di]

Sunday['s?ndi]

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/890206.htmlTechArticlephp gets the day of the week and the dates corresponding to Monday of this week and next Monday $today=date(" Y-m-d"); echo $today;//You can get what day it is today. Output 2014-9-29 //First define a number...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template