diff --git a/reference/calendar/functions/easter-date.xml b/reference/calendar/functions/easter-date.xml index d4e0b45155..e4ab52eff5 100644 --- a/reference/calendar/functions/easter-date.xml +++ b/reference/calendar/functions/easter-date.xml @@ -107,6 +107,56 @@ echo date("M-d-Y", easter_date(2001)); // Apr-15-2001 + + &reftitle.notes; + + + easter_date relies on your system's C library time + functions, rather than using PHP's internal date and time functions. As a + consequence, easter_date uses the + TZ environment variable to determine the time zone it + should operate in, rather than using PHP's + default time zone, which may + result in unexpected behaviour when using this function in conjunction + with other date functions in PHP. + + + As a workaround, you can use the easter_days with + DateTime and DateInterval to + calculate the start of Easter in your PHP time zone as follows: + + + +add(new DateInterval("P{$days}D")); +} + +foreach (range(2012, 2015) as $year) { + printf("Easter in %d is on %s\n", + $year, + get_easter_datetime($year)->format('F j')); +} +?> +]]> + + &example.outputs; + + + + + + + &reftitle.seealso;