教程 > php教程 > 阅读:28

php calendar——迹忆客-ag捕鱼王app官网


php calendar 简介

日历扩展包含了简化不同日历格式间的转换的函数。

它是基于 julian day count(儒略日计数),是从公元前 4713 年 1 月 1 日开始计算的。

注释:如需在日历格式之间转换,必须首先转换为 julian day count,然后再转换为您需要的日历格式。

注释:julian day count(儒略日计数)与 julian calendar(儒略历法) 不是一回事!


安装

为了让这些函数能够工作,您必须通过 --enable-calendar 编译 php。

linux 源码安装示例

./configure --prefix=/usr/local/php/ --enable-calendar

php 的 windows 版本已内建了对日历扩展的支持。因此,calendar 函数会自动工作。


php calendar 函数

函数 描述
针对指定的年份和历法,返回一个月中的天数。
把儒略日计数转换为指定历法的日期。
返回有关指定历法的信息。
把指定历法的日期转换为儒略日计数。
返回指定年份的复活节午夜的 unix 时间戳。
返回指定年份的复活节与 3 月 21 日之间的天数。
把法国共和历法的日期转换成为儒略日计数。
把格利高里历法的日期转换成为儒略日计数。
返回日期在周几。
返回月的名称。
把儒略日计数转换为法国共和历法的日期。
把儒略日计数转换为格利高里历法的日期。
把儒略日计数转换为犹太历法的日期。
把儒略日计数转换为儒略历法的日期。
把儒略日计数转换为 unix 时间戳。
把犹太历法的日期转换为儒略日计数。
把儒略历法的日期转换为儒略日计数。
把 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

查看笔记

扫码一下
查看教程更方便
网站地图