PHP easter_date() function

P
PHP cal_to_jd() function
PHP easter_days() function

In this article, you will learn to get the Easter midnight timestamp(Unix) for the specified year. The easter_date() function is used to do so.

Note: 21st March is called Equinox. So, the Sunday after the full moon that appears after or on the Spring Equinox is the date of Easter Day.

What is the syntax of the easter_date() function in PHP?

easter_date(year);
ParameterDetails
yearThe year to get the Easter date of (between 1970 and 2037). By default, it considers the current time- Required
PHP easter_date() function

Examples of the easter_date() function

Example 1. Get the easter date for the different years. See whats happens if you have given the wrong year, that is out of the range

<?php
echo date("M-d-Y",easter_date());
echo date("M-d-Y",easter_date(1875));
echo date("M-d-Y",easter_date(2021));
echo easter_date();

?>
PHP cal_to_jd() function
PHP easter_days() function

Tutor Network

Share this

Learn PHP from A to Z