CFLib.org – Common Function Library Project

getPascha([y])

Last updated May 01, 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>

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

Created by Raymond Camden / Design by Justin Johnson