Fonctions de calendrier PHP

Introduction au Calendar PHP

L'extension du calendrier contient des fonctions pour simplifier la conversion entre différents formats de calendrier.

Il est basé sur le compte des jours juliens (compte des jours juliens), et commence à compter à partir du 1er janvier 4713 avant J.-C.

Remarque :Pour convertir entre les formats de calendrier, vous devez d'abord convertir en compte des jours juliens, puis en le format de calendrier de votre choix.

Remarque :Julian Day Count (compte des jours juliens) et le calendrier julien ne font pas référence à la même chose !

Installation

To make these functions work, you must compile PHP with --enable-calendar.

PHP's Windows version has built-in support for the calendar extension, so the Calendar functions will work automatically.

PHP 5 Calendar functions

Function Description
cal_days_in_month() Return the number of days in a month for a specified year and calendar.
cal_from_jd() Convert Julian day count to a date for a specified calendar.
cal_info() Return information about a specified calendar.
cal_to_jd() Convert a date from a specified calendar to Julian day count.
easter_date() Return the Unix timestamp for Easter midnight for a specified year.
easter_days() Return the number of days between Easter and March 21 for a specified year.
frenchtojd() Convert French Republican calendar date to Julian day count.
gregoriantojd() Convert Gregorian calendar date to Julian day count.
jddayofweek() Return the day of the week for the date.
jdmonthname() Return the name of the month.
jdtofrench() Convert Julian day count to French Republican calendar date.
jdtogregorian() Convert Gregorian calendar to Julian day count.
jdtojewish() Convert Julian day count to Jewish calendar date.
jdtojulian() Convert Julian day count to Julian calendar date.
jdtounix() Convert Julian day count to Unix timestamp.
jewishtojd() Convert Jewish calendar date to Julian day count.
juliantojd() Convert Julian calendar date to Julian day count.
unixtojd() Convert Unix timestamp to Julian day count.

PHP 5 predefined Calendar constants

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