php 获取任意月的最后一天

 
更多

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));
打赏

本文固定链接: https://www.cxy163.net/archives/4591 | 绝缘体

该日志由 绝缘体.. 于 2013年05月23日 发表在 未分类 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: php 获取任意月的最后一天 | 绝缘体
关键字: , , , ,

php 获取任意月的最后一天:等您坐沙发呢!

发表评论


快捷键:Ctrl+Enter