本文主要是介绍PHP 获取指定月对应天数的代码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
<?php/*** 获取指定月对应的天数* www.jbxue.com*/$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)); ?>
本文出处参考:[url=http://blog.csdn.net/maitiandaozi/article/details/8808041]http://blog.csdn.net/maitiandaozi/article/details/8808041[/url]
这篇关于PHP 获取指定月对应天数的代码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!