GetEaster([TheYear])
Last updated September 04, 2001
Version: 1 | Requires: CF5 | Library: DateLib
Description:
Returns the date for Easter in a given year. If no year is specified, defaults to the current year.
Return Values:
Returns a date object.
Example:
<CFOUTPUT>
Easter falls on #DateFormat(GetEaster(), 'dddd mmmm dd, yyyy')# this year.
</CFOUTPUT>
Parameters:
Name | Description | Required |
---|---|---|
TheYear | The year to get Easter for. | No |
Full UDF Source:
/**
* Returns the date for Easter in a given year.
* Minor edits by Rob Brooks-Bilson (rbils@amkor.com).
*
* @param TheYear The year to get Easter for.
* @return Returns a date object.
* @author Ken McCafferty (mccjdk@yahoo.com)
* @version 1, September 4, 2001
*/
function GetEaster() {
Var TheYear=iif(arraylen(arguments) gt 0,"arguments[1]", "Year(Now())");
Var century = Int(TheYear/100);
Var G = TheYear MOD 19;
Var K = Int((century - 17)/25);
Var I = (century - Int(century/4) - Int((century - K)/3) + 19*G + 15) MOD 30;
Var H = I - Int((I/28))*(1 - Int((I/28))*Int((29/(I + 1)))*Int(((21 - G)/11)));
Var J = (TheYear + Int(TheYear/4) + H + 2 - century + Int(century/4)) MOD 7;
Var L = H - J;
Var EasterMonth = 3 + Int((L + 40)/44);
Var EasterDay = L + 28 - 31*Int((EasterMonth/4));
return CreateDate(TheYear,EasterMonth,EasterDay);
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016