PHP 5Calendar function About PHP Calendar
The calendar extension contains functions that simplify conversions between different calendar formats.
It is based on Julian Day count (Julian days count), which was calculated starting from January 1, 4713 BC.
Note: to convert between calendar formats, you must first convert to Julian day Count and then convert to the calendar format you want.
notes: Julian Day Count (Julian's count) is not the same thing as Julian calendar.
Installation
In order for these functions to work, you must compile PHP through--enable-calendar.
The Windows version of PHP has built-in support for calendar extensions. Therefore, the Calendar function automatically works.
PHP 5 Calendar function
function |
Description |
Cal_days_in_month () |
Returns the number of days in the one month for the specified year and calendar. |
CAL_FROM_JD () |
Converts the Julian day count to the date of the specified calendar. |
Cal_info () |
Returns information about the specified calendar. |
CAL_TO_JD () |
Converts the date of the specified calendar to a Julian day count. |
Easter_date () |
Returns the Unix timestamp for the Easter midnight of the specified year. |
Easter_days () |
Returns the number of days between Easter and March 21 for the specified year. |
FRENCHTOJD () |
Convert the date of the French Republican calendar into a Julian day count. |
GREGORIANTOJD () |
Convert the date of the Gregorian calendar into a Julian day count. |
Jddayofweek () |
Returns the day of the week. |
Jdmonthname () |
Returns the name of the month. |
Jdtofrench () |
Convert the Julian day count to the date of the French Republican calendar. |
Jdtogregorian () |
Convert the Julian day count to the date of the Gregorian calendar. |
Jdtojewish () |
Convert the Julian day count to the date of the Jewish calendar. |
Jdtojulian () |
Convert the Julian day count to the date of the Julian calendar. |
Jdtounix () |
Converts the Julian day count to a Unix timestamp. |
JEWISHTOJD () |
Convert the date of the Jewish calendar to a Julian day count. |
JULIANTOJD () |
Convert the date of the Julian calendar to the Julian day count. |
UNIXTOJD () |
Converts a Unix timestamp to a Julian day count. |
PHP 5 pre-defined Calendar constants
Constants |
type |
PHP version |
Cal_gregorian |
Integer |
PHP 4 |
Cal_julian |
Integer |
PHP 4 |
Cal_jewish |
Integer |
PHP 4 |
Cal_french |
Integer |
PHP 4 |
Cal_num_cals |
Integer |
PHP 4 |
Cal_dow_dayno |
Integer |
PHP 4 |
Cal_dow_short |
Integer |
PHP 4 |
Cal_dow_long |
Integer |
PHP 4 |
Cal_month_gregorian_short |
Integer |
PHP 4 |
Cal_month_gregorian_long |
Integer |
PHP 4 |
Cal_month_julian_short |
Integer |
PHP 4 |
Cal_month_julian_long |
Integer |
PHP 4 |
Cal_month_jewish |
Integer |
PHP 4 |
Cal_month_french |
Integer |
PHP 4 |
Cal_easter_default |
Integer |
PHP 4.3 |
Cal_easter_roman |
Integer |
PHP 4.3 |
Cal_easter_always_gregorian |
Integer |
PHP 4.3 |
Cal_easter_always_julian |
Integer |
PHP 4.3 |
Cal_jewish_add_alafim_geresh |
Integer |
PHP 5.0 |
Cal_jewish_add_alafim |
Integer |
PHP 5.0 |
Cal_jewish_add_gereshayim |
Integer |
PHP 5.0 |
PHP 5 Calendar function