DateUtilsEasterSunday 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: 2023.1.2.0
public static DateTime EasterSunday(
	int year,
	EasterMethod method
)

Parameters

year  Int32
The year in which to calculate Easter
method  EasterMethod
The method to use for calculating Easter

Return Value

DateTime
The 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);

Exceptions

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

See Also