实例
输出不同年份的复活节与 3 月 21 日之间的天数:
<?php
echo "Easter Day is ". easter_days() . " days after March 21 this year.<br />";
echo "Easter Day was ". easter_days(1990) . " days after March 21 in 1990.<br />";
echo "Easter Day was ". easter_days(1342) . " days after March 21 in 1342.<br />";
echo "Easter Day will be ". easter_days(2050) . " days after March 21 in 2050.";
?>
echo "Easter Day is ". easter_days() . " days after March 21 this year.<br />";
echo "Easter Day was ". easter_days(1990) . " days after March 21 in 1990.<br />";
echo "Easter Day was ". easter_days(1342) . " days after March 21 in 1342.<br />";
echo "Easter Day will be ". easter_days(2050) . " days after March 21 in 2050.";
?>
运行代码 >>
定义和用法
easter_days() 返回指定年份的复活节与 3 月 21 日之间的天数。
提示:复活节的日期是被定义在每年春分(3 月 21 日)月圆之后第一个星期日。
语法
easter_days(year,method);
参数 | 描述 |
---|---|
year | 可选。定义用于计算复活节日期的年份,为一个数字。若省略,默认使用当年,本地时间。 |
method | 可选。允许您计算其它历法的复活节日期。例如,如果设置为 CAL_EASTER_ROMAN,则使用 1582 - 1752 年期间的格利高里历法。 |
技术细节
返回值: | 返回指定年份的复活节与 3 月 21 日之间的天数。 |
---|---|
PHP 版本: | 4+ |
更新日志: | 在 PHP 4.3 中,year 参数是可选的,method 参数是新增的。 |
PHP Calendar 参考手册其他扩展