获取某天所在月的天数
/**
* 获某天所在月的天数
* @param int $n
* @param $dateKey=20200908
* @return int
*/
public static function getMonthDays($dateKey)
{
return (int)date('t', strtotime($dateKey));
}
本文介绍了一个实用的PHP函数,用于计算指定日期所在月份的总天数。通过使用strtotime和date函数,该方法能够准确地返回任何给定月份的天数。
/**
* 获某天所在月的天数
* @param int $n
* @param $dateKey=20200908
* @return int
*/
public static function getMonthDays($dateKey)
{
return (int)date('t', strtotime($dateKey));
}
655
768

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