php 获取指定月最后一天:
<?php
function getthemonth($date)
{
$firstday = date('Y-m-01', strtotime($date));
$lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
return $lastday;
}
echo getthemonth('2011-5-16');
?>
本文介绍了一个PHP函数,该函数能够计算并返回指定月份的最后一日。通过将给定日期转换为该月的第一天,然后增加一个月再减去一天来实现。
php 获取指定月最后一天:
<?php
function getthemonth($date)
{
$firstday = date('Y-m-01', strtotime($date));
$lastday = date('Y-m-d', strtotime("$firstday +1 month -1 day"));
return $lastday;
}
echo getthemonth('2011-5-16');
?>
1071
474

被折叠的 条评论
为什么被折叠?
