CFLib.org – Common Function Library Project

getPascha([y])

Last updated May 1, 2006

author

John E Pusey

Version: 1 | Requires: CF6 | Library: DateLib

Description:
Returns the date for Orthodox Easter (Pascha) in a given year. If no year is specified, defaults to the current year.

Return Values:
Returns a date.

Example:

<cfoutput>
	#dateFormat(getPascha(), "full")#<br>
	#dateFormat(getPascha(2010), "full")#
</cfoutput>

Parameters:

Name Description Required
y Year. Defaults to the current year. No

Full UDF Source:

<!---
 Returns the date for Orthodox Easter (Pascha) in a given year.
 
 @param y 	 Year. Defaults to the current year. (Optional)
 @return Returns a date. 
 @author John E Pusey (nightgazing@gmail.com) 
 @version 1, April 9, 2007 
--->
<cffunction name="getPascha" returntype="date">
	<cfargument name="y" type="numeric" required="false" default="#year(now())#">
	
	<cfset var t = 0>
	<cfset var dd = 0>
	<cfset var mm = 0>
	
	<cfset t = (19 * (y mod 19) + 16) mod 30>
	<cfset dd = 3 + t + (2 * (y mod 4) + 4 * (y mod 7) + 6 * t) mod 7>

	<cfif y lt 1924>
		<cfset dd = dd - 13>
	</cfif>

	<cfif dd gt 30>
		<cfset dd = dd - 30>
		<cfset mm = 5>
	<cfelse>
		<cfset mm = 4>
	</cfif>
	
	<cfif dd lt 1>
		<cfset dd = dd + 31>
		<cfset mm = 3>
	</cfif>

  <cfreturn createDate(y, mm, dd)>
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson