viewed 4052 times and licensed 20 times
Calculates the date of Easter Sunday for the given year.
Open Office: EASTERSUNDAY
View version details
Contents  |
|
Group Description
This component calculates the date of Easter Sunday for a specified
Year. Two functions are presented: The first returns a serial number, equivalent to that which you find in Excel, with represents the date of Easter Sunday. The second converts this value into a human readable form (a string!).
Many other important dates (holidays!) can also be calculated from this function, for example:
- Septuagesima Sunday = easterSunday(...) -63
- Sexagesima Sunday = easterSunday(...) -56
- Shrove Sunday = easterSunday(...) -49
- Shrove Tuesday = easterSunday(...) -47
- Ash Wednesday = easterSunday(...) -46
- Mothers Day (UK only)= easterSunday(...) -21
- Passion Sunday = easterSunday(...) -14
- Palm Sunday = easterSunday(...) -7
- Holy or Maundy Thursday = easterSunday(...) -3
- Good Friday = easterSunday(...) -2
- Rogation Sunday = easterSunday(...) +35
- Ascension Day = easterSunday(...) +39
- Pentecost or Whitsunday = easterSunday(...) +49
- Whitmundy = easterSunday(...) +50
- Trinity Sunday = easterSunday(...) +56
- Corpus Christi = easterSunday(...) +60 (or easterSunday(...)+63 Catholic Church in the United States)
Example 1:
- To calculate the date of Good Friday for the next 10 years
#include <stdio.h>
#include <codecogs/units/date/eastersunday.h>
#include <codecogs/units/date/dateymd.h>
using namespace Units::Date;
int main()
{
for(int year=2004; year<=2014; year++)
{
int ndate=easterSunday(year) - 2;
int d,m,y;
dateYMD(ndate, y, m, d);
printf("\n In year %d, Good Friday is on %d/%d", y, d, m);
}
return 0;
}
Output:
In year 2004, Good Friday is on 9/4
In year 2005, Good Friday is on 25/3
In year 2006, Good Friday is on 14/4
In year 2007, Good Friday is on 6/4
In year 2008, Good Friday is on 21/3
In year 2009, Good Friday is on 10/4
In year 2010, Good Friday is on 2/4
In year 2011, Good Friday is on 22/4
In year 2012, Good Friday is on 6/4
In year 2013, Good Friday is on 29/3
In year 2014, Good Friday is on 18/4
Interface
#include <codecogs/units/date/eastersunday.h>
using namespace Units::Date;
| int | easterSunday (int year)[inline] Calculates the date of Easter Sunday returning a serial Julian date. |
 | Integer | cc_easterSunday (Integer year) This function is available as a Microsoft Excel add-in. |
| std::string | easterSunday_str (int year) Returns a date of Easter Sunday as a character string |
 | String | cc_easterSunday_str (Integer year) This function is available as a Microsoft Excel add-in. |
Function Documentation
Calculates the date of Easter Sunday in the specified
Year, returning the serial Julian date (see
date).
The calculation of the Day and Month for Easter Sunday that falls within the specified Year (for the Gregorian calendar) is performed using the equations:
References:
Tondering, C. 2003. www.tondering.dk/claus/cal/node3.html
Parameters:
| year | the year to compute easter for |
Returns:
- the serial Julian date (see date)
Authors:
- Will Bateman (Oct 2004)
Returns the date of Easter in a string format with day followed by month for the
year specified.
Example 2:
int main(void)
{
for(int year=2004; year<=2014; year++)
{
printf("\n%s",Units::Date::easterSunday_str(year).c_str());
}
}
Note:
Parameters:
| year | the year to compute easter for |
Returns:
- a string containing the date
Page Comments
You must login to leave a messge
Last Modified: 10 Feb 08 @ 17:30 Page Rendered: 2010-03-11 04:05:35