PHP easter_date Function

Submitted by: 
Visitors have accessed this post 1051 times.

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.

resultHope 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.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.