欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-04-18 21:01:26
...
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...