PHP-Kalender-Funktionen

PHP Calendar Kurzanleitung

Die Kalendererweiterung enthält Funktionen zur Vereinfachung der Umwandlung zwischen verschiedenen Kalenderformaten.

Es basiert auf der Julianischen Tageszählung und beginnt mit dem 1. Januar 4713 v. Chr. mit der Zählung der Tage.

Anmerkung:Um zwischen Kalenderformaten umzukonvertieren, müssen Sie zunächst in die Julianische Tageszählung umwandeln und dann in das von Ihnen gewählte Kalenderformat konvertieren.

Anmerkung:Julian Day Count (Julianische Tageszählung) und Julianischer Kalender (Julianischer Kalender) sind nicht dasselbe!

Installation

In order for these functions to 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 date to Julian day count.
gregoriantojd() Convert Gregorian 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 date.
jdtogregorian() Convert Gregorian calendar to Julian day count.
jdtojewish() Convert Julian day count to Jewish date.
jdtojulian() Convert Julian day count to Julian date.
jdtounix() Convert Julian day count to Unix timestamp.
jewishtojd() Convert Jewish date to Julian day count.
juliantojd() Convert Julian 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