PHP获取月份最后一天方法

WBOY
Release: 2016-06-20 13:04:18
Original
3597 people have browsed it

PHP获取月份最后一天方法

echo date('Y-m-t'); //获取当前月的最后一天

echo date('Y-m-t',strtotime("09.13.1987")); //获取指定月份的最后一天

//获取指定日期的上个月的最后一天

$curtime="1987-09-13";

$time=strtotime($curtime );

date('Y-m-t',strtotime('last month',$time));

//获取指定日期的下个月的最后一天

$curtime="2010-04-11";

$time=strtotime($curtime );

date('Y-m-t',strtotime('next month',$time));


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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!