您的位置:首页 > 编程语言 > PHP开发

PHP 获取指定月对应天数

2013-04-16 11:47 218 查看
$firstday = mktime(0,0,0,$month,1,$year); //取所给年月的第一天的UNIX时间戳
$days = date('t',$firstday); //返回指定月份的天数
$days = cal_days_in_month(CAL_GREGORIAN, 4, 2013);//返回2003-02的天数
$days = date('t', strtotime($year . '-' . $month . '-01'));//返回天数
$ndays = date("t"); //return the number of days for this month and this year
date("j",mktime(0,0,0,$month+1,0,$year));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: