PHP easter_days()

Submitted by: 
Visitors have accessed this post 111 times.

PHP easter_days()

easter_days() function returns the number of days after March 21, on which Easter falls for 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)

method - allows you to calculate Easter dates based on other calendars. E.g. it uses the Gregorian calendar during the years 1582 - 1752 when set to CAL_EASTER_ROMAN. (optional)

Note: If the year is outside of the range for Unix timestamps (before 1970 or after 2037), this function will generate a warning.


It shows the basic use of this function.

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>PHP easter_days()</title>
  5. </head>
  6. <body>
  8. <?php
  9. echo(easter_days());//default date
  10. echo"<br />";
  11. echo(easter_days(1990));//year in 1990
  12. echo"<br />";
  13. echo(easter_days(1342));//year in 1342
  14. echo"<br />";
  15. echo(easter_days(2050));//year in 2050
  16. ?>
  18. </body>
  19. </html>

This is the output of the codes above.



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.