Home >Backend Development >PHP Tutorial >On the last day of school, use php to get the code for the first and last day of the month.

On the last day of school, use php to get the code for the first and last day of the month.

WBOY
WBOYOriginal
2016-07-29 08:42:44945browse

Copy code The code is as follows:


function getthemonth($date)
{
$firstday = date('Y-m-01', strtotime($date));
$lastday = date('Y-m-d ', strtotime("$firstday +1 month -1 day"));
return array($firstday, $lastday);
}

The above introduces the code for getting the first and last day of a month using php on the last day of school, including the content of the last day of school. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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