Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

PHP 5 Calendar function


May 11, 2021 PHP


Table of contents


PHP 5 Calendar function

This section describes the Calendar function of PHP5, which is used to support calendars.


Introduction to PHP Calendar

Calendar extensions include functions that simplify conversion between different calendar formats.

It is based on Julian Day Count (Julian Day Count) and was calculated from January 1, 4713 D.

Note: To convert between calendar formats, you must first convert to Julian Day Count and then to the calendar format you want.

Note: Julian Day Count is not the same thing as Julian Calendar!


Installation

For these functions to work, you must compile PHP through --enable-calendar.

PhP's version of Windows has built-in support for calendar extensions. Therefore, the Calendar function works automatically.


PHP 5 Calendar function

function describe
cal_days_in_month() Returns the number of days in a month for the designated year and calendar.
cal_from_jd() Convert the Confucian day count to the date of the specified calendar.
cal_info() Returns information about the specified calendar.
cal_to_jd() Convert the date of the specified calendar to the Constantian day count.
easter_date() Returns the UNIX timestamp of the Easter midnight in the designated year.
easter_days() Returns the number of days between the specified year and between March 21.
frenchtojd() Conversion of the Date of French Republic Calendar into a Confucian Day count.
gregoriantojd() Conversion of the Date of Gregory calendar to the Confucian day count.
jddayofweek() The return date is on the week.
jdmonthname() Return to the name of the month.
jdtofrench() Conversion of the Confucian day count to the Date of French Republic Calendar.
jdtogregorian() Convert the Confucian day count to the date of Gregori Corporation.
jdtojewish() Convert the Confucian day count to the date of Jewish calendar.
jdtojulian() Conversion of the Confucian Day count to the date of Confulor calendar.
jdtounix() Convert the Confucian day count to UNIX timestamp.
jewishtojd() Convert the date of the Jewish calendar to the Confucian day count.
juliantojd() Conversion of the Date of the Confucian calendar to the Confucian day count.
unixtojd() Convert UNIX timestamp to the Confucian day count.

PHP 5 Predefined Calendar constant

constant 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

That's all about PHP5 calendar functions.