Introduction
The PHP Calendar functions are for working with various calendar formats. Basically the calendar formats are based on Julian dates. Here I am going to explain some of PHP calendar functions.
PHP cal_days_in_month function
This function returns the number of days in a month of a given year and calendar.
Syntax
| cal_days_in_month (calendar, month, year) |
Parameters in cal_days_in_month function
It has three parameters and every parameter is required in this function.
| Parameter | Description |
| calendar | It specifies which type of calendar. |
| month | It specifies month number. |
| year | It specifies year. |
Example of cal_days_month function:
|
<?php $daysval=cal_days_in_month(CAL_GREGORIAN,2,2016); echo("The $daysval days will be in Feb 2016"); |
Output
PHP cal_from_jd function
It converts the given Julian day into date of the given calendar.
Syntax
| cal_from_jd (jday, calendar) |
Parameters in cal_from_jd function
It have two parameters and every parameter is required in this function.
| Parameter | Description |
| calendar | It specifies which type of calendar. |
| jday | It is used for count Julian days. |
Example of cal_from_jd function:


Join the conversation! Your thoughts help the community grow.