cal_days_in_month() function in PHP


The cal_days_in_month() function returns the number of days in a month for a specified year and calendar.

Syntax

cal_days_in_month(calendar,month,year);

Parameters

  • calendar − The calendar to be used.

  • month − The month to be specified.

  • year − The year to be specified.

Return

The cal_days_in_month() function returns the number of days in a month for a specified year and calendar.

Example

The following is an example −

Live Demo

<?php
   $res = cal_days_in_month(CAL_GREGORIAN, 3, 2018);
   echo "$res days";
?>

Output

31 days

Updated on: 30-Jul-2019

127 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements