Monday 26 August 2013

PHP Calendar Functions

The calendar extension presents a series of functions to simplify converting between different calendar formats.
The intermediary or standard it is based on is the Julian Day Count. The Julian Day Count is a count of days starting from January 1st, 4713 B.C. To convert between calendar systems, you must first convert to Julian Day Count, then to the calendar system of your choice.

Installation:

To get these functions to work, you have to compile PHP with --enable-calendar.

Runtime Configuration:

This extension has no configuration directives defined in php.ini.

PHP Calendar Constants:

ConstantDescriptionPHP
CAL_GREGORIANGregorian calendar3
CAL_JULIANJulian calendar3
CAL_JEWISHJewish calendar3
CAL_FRENCHFrench Republican calendar3
CAL_NUM_CALS 3
CAL_DOW_DAYNO 3
CAL_DOW_SHORT 3
CAL_DOW_LONG 3
CAL_MONTH_GREGORIAN_SHORT 3
CAL_MONTH_GREGORIAN_LONG 3
CAL_MONTH_JULIAN_SHORT 3
CAL_MONTH_JULIAN_LONG 3
CAL_MONTH_JEWISH 3
CAL_MONTH_FRENCH 3
CAL_EASTER_DEFAULT 4
CAL_EASTER_DEFAULT 4
CAL_EASTER_ROMAN 4
CAL_EASTER_ALWAYS_GREGORIAN 4
CAL_EASTER_ALWAYS_JULIAN 4
CAL_JEWISH_ADD_ALAFIM_GERESH 5
CAL_JEWISH_ADD_ALAFIM 5
CAL_JEWISH_ADD_GERESHAYIM 5

List of Functions:

PHP: indicates the earliest version of PHP that supports the function.
FunctionDescriptionPHP
cal_days_in_month()Returns the number of days in a month for a specified year and calendar4
cal_from_jd()Converts a Julian day count into a date of a specified calendar4
cal_info()Returns information about a given calendar4
cal_to_jd()Converts a date to Julian day count4
easter_date()Returns the Unix timestamp for midnight on Easter of a specified year3
easter_days()Returns the number of days after March 21, on which Easter falls for a specified year3
FrenchToJD()Converts a French Republican date to a Julian day count3
GregorianToJD()Converts a Gregorian date to a Julian day count3
JDDayOfWeek()Returns the day of a week3
JDMonthName()Returns a month name3
JDToFrench()Converts a Julian day count to a French Republican date3
JDToGregorian()Converts a Julian day count to a Gregorian date3
jdtojewish()Converts a Julian day count to a Jewish date3
JDToJulian()Converts a Julian day count to a Julian date3
jdtounix()Converts a Julian day count to a Unix timestamp4
JewishToJD()Converts a Jewish date to a Julian day count3
JulianToJD()Converts a Julian date to a Julian day count3
unixtojd()Converts a Unix timestamp to a Julian day count4

No comments:

Post a Comment