PHP Kalender Funktioner
PHP Kalender Introduktion
Kalenderudvidelsen indeholder funktioner til at forenkle konvertering mellem forskellige kalenderformater.
Det er baseret på Julian Day Count (儒略日计数) og starter med den 1. januar 4713 f.Kr.
Bemærkninger:Hvis du skal konvertere mellem kalenderformater, skal du først konvertere til Julian Day Count, før du konverterer til det valgte kalenderformat.
Bemærkninger:Julian Day Count (儒略日计数) og Julian Calendar (儒略历法) er ikke det samme!
安装
为了让这些函数能够工作,您必须通过 --enable-calendar 编译 PHP。
PHP 的 Windows 版本已内建了对日历扩展的支持。因此,Calendar 函数会自动工作。
PHP 5 Calendar 函数
函数 | 描述 |
---|---|
cal_days_in_month() | 针对指定的年份和历法,返回一个月中的天数。 |
cal_from_jd() | 将儒略日计数转换为指定历法的日期。 |
cal_info() | 返回有关指定历法的信息。 |
cal_to_jd() | 将指定历法中的日期转换为儒略日计数。 |
easter_date() | 返回指定年份的复活节午夜的 Unix 时间戳。 |
easter_days() | 返回指定年份的复活节与 3 月 21 日之间的天数。 |
frenchtojd() | 将法国共和历的日期转换成为儒略日计数。 |
gregoriantojd() | 将格利高里历法的日期转换成为儒略日计数。 |
jddayofweek() | 返回日期在周几。 |
jdmonthname() | 返回月的名称。 |
jdtofrench() | 将儒略日计数转换为法国共和历的日期。 |
jdtogregorian() | 将格利高里历法转换成为儒略日计数。 |
jdtojewish() | 将儒略日计数转换为犹太历法的日期。 |
jdtojulian() | 将儒略日计数转换为儒略历法的日期。 |
jdtounix() | 将儒略日计数转换为 Unix 时间戳。 |
jewishtojd() | 将犹太历法的日期转换为儒略日计数。 |
juliantojd() | 将儒略历法的日期转换为儒略日计数。 |
unixtojd() | 将 Unix 时间戳转换为儒略日计数。 |
PHP 5 预定义的 Calendar 常量
常量 | 类型 | PHP 版本 |
---|---|---|
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 |