php日期所在月的天数_PHP教程

原创
2016-07-20 11:06:44 671浏览

php日期所在月的天数

public function daysOfMonth ($year=NULL,$month=NULL) {
if ($year===NULL) {
$year = $this->getPart('yy');
}
if ($month===NULL) {
$month = $this->getPart('mm');
}
if ($month==2)
{
if (($year % 4 == 0 && $year % 100 != 0) || $year %

400 == 0)
$result = 29;
else
$result = 28;
}
elseif ($month == 4 || $month == 6 || $month == 9 || $month

== 11)
$result = 30;
else
$result = 31;
return $result;
}


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445010.htmlTechArticlephp日期所在月的天数 public function daysOfMonth ($year=NULL,$month=NULL) { if ($year===NULL) { $year = $this-getPart('yy'); } if ($month===NULL) { $month = $this-getPart('m...
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。