﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
1715	Calculation for Easter to be added to Date.au3	czardas	Gary	"It was suggested to me that the following UDF would make a nice addition to Date.au3

EasterHodges.au3
{{{
; #FUNCTION# ======================================================================================
; Name...........: _DateEaster
; Description ...: Calculates Easter Sunday for a given year.
; Syntax.........: _DateEaster($iYr)
; Parameters ....: $iYr     - The year used to calculate Easter
; Return values .: Success  - Easter in the format YYYY/MM/DD
;                  Failure  - Returns an empty string and sets @error = 1
; Author ........: David Hodges, (conversion to AutoIt by czardas)
; Remarks .......: Applies to the revised calculation in the Gregorian calendar from 1583 to 4099 AD.
; Related .......: http://www.gmarts.org/index.php?go=415#EasterHodges
; Example .......; Yes
; ==================================================================================================

Func _DateEaster($iYr)
    If StringIsInt($iYr) = 0 Or $iYr < 1583 Or $iYr > 4099 Then Return SetError(1, 0, """")

    Local $iA, $iB, $iC, $iD, $iE, $iF, $iG, $iH, $iJ, $iK, $iM, $iDy, $iMth
    $iA = Int($iYr / 100)
    $iB = Mod($iYr, 100)
    $iC = Int(3 * ($iA + 25) / 4)
    $iD = Mod (3 * ($iA + 25), 4)
    $iE = Int(8 * ($iA + 11) / 25)
    $iF = Mod(5 * $iA + $iB, 19)
    $iG = Mod((19 * $iF + $iC - $iE), 30)
    $iH = Int((11 * $iG + $iF) / 319)
    $iJ = Int((60 * (5 - $iD) + $iB) / 4)
    $iK = Mod(60 * (5 - $iD) + $iB, 4)
    $iM = Mod(2 * $iJ - $iK - $iG + $iH, 7)
    $iDy = Mod($iG - $iH + $iM + 114, 31) + 1
    $iMth = Int(($iG - $iH + $iM + 114) / 31)

    If $iDy < 10 Then $iDy = String(""0"" & $iDy)
    Return $iYr & ""/0"" & $iMth & ""/"" & $iDy
EndFunc
}}}

Example:
{{{
#include 'EasterHodges.au3'

Local $EasterSunday = _DateEaster(@YEAR)
If @error Then Exit
ConsoleWrite($EasterSunday & @CRLF)
}}}
If you decide the code requires revision, I will do my best to implement any changes you suggest. If you have any other concerns, please let me know."	Feature Request	closed		Standard UDFs		None	Rejected	Easter	czardas11@…
