作者:寤丨惘_191 | 来源:互联网 | 2018-07-17 01:13
ec(2);日期所在月的天数 *@returnint add * publicfunctiondaysOfMonth($yearNULL,$monthNULL){ if($yearNULL){ $year$this->getPart(y
日期所在月的天数
* @return int add
*/
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;
}