Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

PHP offers a powerful way to convert dates from one calendar system to another. In order
to do this, you must first convert a date into a Julian Day Count. You then convert that
integer back into a date according to another calendar.


These functions require the calendar extension. You may load it dynamically, or compile
it into PHP.


integer easter_date(integer year)


Use easter_date to get the timestamp for midnight on Easter for a given year.


<?
print(easter_date(2000));
?>


integer easter_days(integer year)


The easter_days function returns the number of days after March 21 on which Easter
falls for the given year.


<?
print(easter_days(2000));
?>


integer frenchtojd(integer month, integer day, integer year)


The frenchtojd function returns the Julian Day Count for the given French Republican
calendar date.


<?
$jdc = frenchtojd(1,1,1);
print(jdtogregorian($jdc));
?>


integer gregoriantojd(integer month, integer day, integer year)


The gregoriantojd function returns the Julian Day Count for the given Gregorian date.


<?
$jdc = gregoriantojd(1,1,1);
print(jdtogregorian($jdc));

Free download pdf