PHP easter_date Function
Submitted by alpha_luna on Wednesday, July 13, 2016 - 16:15.
Today, we are going to learn about easter_date.
The complete code.
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:
easter_date(year)
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.
Example
It shows the basic use of this function.PHP Source Code
- <?php
- echo"<br />";
- echo"<br />";
- echo"<br />";
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- </head>
- <body>
- <?php
- echo(easter_date());//no date format
- echo"<br />";
- echo(date("M-d-Y", easter_date(2000)));//year of 2000
- echo"<br />";
- echo(date("M-d-Y", easter_date(2001)));//year of 2001
- echo"<br />";
- echo(date("M-d-Y", easter_date(2002)));//year of 2002
- ?>
- </body>
- </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.Add new comment
- 176 views