PHP cal_days_in_month() Function

In this chapter you will learn:

  1. Definition for PHP cal_days_in_month() Function
  2. Syntax for PHP cal_days_in_month() Function
  3. Parameter for PHP cal_days_in_month() Function
  4. Example - returns the number of days in a month for a specified year

Definition

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

Syntax

PHP cal_days_in_month() Function has the following syntax.

cal_days_in_month(calendar,month,year);

Parameter

PHP cal_days_in_month() Function has the following parameters.

ParameterIs RequiredDescription
calendarRequired.Calendar to use.
monthRequired.Selected Month
yearRequired.Selected year
PHP 5 Predefined Calendar Constants

Example

Returns the number of days in a month for a specified year


<?php
$d=cal_days_in_month(CAL_GREGORIAN,10,2012);
echo "There was $d days in October 2012";
?>

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP cal_from_jd() Function
  2. Syntax for PHP cal_from_jd() Function
  3. Parameter for PHP cal_from_jd() Function
  4. Return value from PHP cal_from_jd() Function
  5. Example - converts a Julian day count into a date of a specified calendar
Home » PHP Tutorial » PHP Calendar Functions
PHP 5 Predefined Calendar Constants
PHP cal_days_in_month() Function
PHP cal_from_jd() Function
PHP cal_info() Function
PHP cal_to_jd() Function
PHP easter_date() Function
PHP easter_days() Function
PHP frenchtojd() Function
PHP gregoriantojd() Function
PHP jddayofweek() Function
PHP jdmonthname() Function
PHP jdtofrench() Function
PHP jdtogregorian() Function
PHP jdtojewish() Function
PHP jdtojulian() Function
PHP jdtounix() Function
PHP jewishtojd() Function
PHP juliantojd() Function
PHP unixtojd() Function