Home  >  Article  >  php教程  >  php automatically gets the starting time of the previous month

php automatically gets the starting time of the previous month

WBOY
WBOYOriginal
2016-09-11 11:19:392405browse

$last_month = date('Y-m', strtotime('last month'));
$last['first'] = $last_month . '-01 00:00:00';
$last['end'] = date(‘Y-m-d H:i:s’, strtotime("$last_month +1 month -1 day +23 hours +59 minutes +59 seconds"));

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