Skip to main content

PHP easter_date Function

Today, we are going to learn about easter_date.

So, what is easter_date() in PHP?

The easter_date() function returns the Unix timestamp for midnight on Easter of a specified year.

Syntax of this function:


year - defines the year to calculate the midnight on Easter from. If the year parameter is omitted, the current year is used. (optional)

Note: If the year is outside of the range for Unix timestamps (before 1970 or after 2037), this function will generate a warning. The easter_days() function can be used instead of easter_date() to calculate Easter for years which fall outside the range.


It shows the basic use of this function.

PHP Source Code

  1. <?php
  2. echo(easter_date());//no date format
  3. echo"<br />";
  4. echo(date("M-d-Y", easter_date(2000)));//year of 2000
  5. echo"<br />";
  6. echo(date("M-d-Y", easter_date(2001)));//year of 2001
  7. echo"<br />";
  8. echo(date("M-d-Y", easter_date(2002)));//year of 2002
  9. ?>

The complete code.

  1. <!DOCTYPE html>
  2. <title>PHP easter_date()</title>
  3. </head>
  5. <?php
  6. echo(easter_date());//no date format
  7. echo"<br />";
  8. echo(date("M-d-Y", easter_date(2000)));//year of 2000
  9. echo"<br />";
  10. echo(date("M-d-Y", easter_date(2001)));//year of 2001
  11. echo"<br />";
  12. echo(date("M-d-Y", easter_date(2002)));//year of 2002
  13. ?>
  15. </body>
  16. </html>
This is the output of the codes above.


Hope that this article will help you a lot.

So what can you say about this article? Share your thoughts in the comment section below or email me at [email protected]. Practice Coding. Thank you very much.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.