Date UtilsEaster Sunday Method
This method can be used to calculate the Easter Sunday date using one of three methods defined by
EasterMethod.
Definition
Namespace: EWSoftware.PDI
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2025.1.9.0
The date on which Easter falls in the specified year as calculated using the specified method.
Assembly: EWSoftware.PDI (in EWSoftware.PDI.dll) Version: 2025.1.9.0
C#
public static DateTime EasterSunday(
int year,
EasterMethod method
)VB
Public Shared Function EasterSunday (
year As Integer,
method As EasterMethod
) As DateTimeC++
public:
static DateTime EasterSunday(
int year,
EasterMethod method
)F#
static member EasterSunday :
year : int *
method : EasterMethod -> DateTime Parameters
- year Int32
- The year in which to calculate Easter
- method EasterMethod
- The method to use for calculating Easter
Return Value
DateTimeThe date on which Easter falls in the specified year as calculated using the specified method.
Remarks
See the EasterMethod enumerated type for the ways in which Easter Sunday can
be calculated. A number of days can be added to or subtracted from the returned date to find other
Easter related dates (i.e. subtract two from the returned date to get the date on which Good Friday
falls).
Example
C#
// Returns 04/11/2004 for Easter
dtEaster = DateUtils.EasterSunday(2004, EasterMethod.Gregorian);
// Calculate Good Friday from that date
dtGoodFriday = dtEaster.AddDays(-2);VB
' Returns 04/11/2004 for Easter
dtEaster = DateUtils.EasterSunday(2004, EasterMethod.Gregorian)
' Calculate Good Friday from that date
dtGoodFriday = dtEaster.AddDays(-2)C++
No code example is currently available or this language may not be supported.F#
No code example is currently available or this language may not be supported.Exceptions
| ArgumentOutOfRangeException | An exception is thrown if the year is not between 1583 and 4099 for the Orthodox and Gregorian methods or if the year is less than 326 for the Julian method. |