Home > Backend Development > PHP Tutorial > PHP获取指定指定月度的天数

PHP获取指定指定月度的天数

PHP中文网
Release: 2023-02-28 14:04:02
Original
3100 people have browsed it

  PHP获取指定指定月份的天数

最近写接口的时候突然发现的非常实用的php函数,在这儿分享一下:

cal_days_in_month(calender,$month,$year);

calender:历法,常量,如CAL_GREGORIAN(阳历);

1031.png

$month:指定的月份;

$year:指定的年份;

返回: 天数

如:

$monthday = cal_days_in_month(CAL_GREGORIAN,3,2016);
  echo $monthday;
Copy after login

输出:31

以上就是PHP获取指定指定月度的天数的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template