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);
Parameter | Details |
---|---|
year | The year to get the Easter date of (between 1970 and 2037). By default, it considers the current time- Required |
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();
?>