#1715 closed Feature Request (Rejected)
Calculation for Easter to be added to Date.au3
Reported by: | czardas | Owned by: | Gary |
---|---|---|---|
Milestone: | Component: | Standard UDFs | |
Version: | Severity: | None | |
Keywords: | Easter | Cc: | czardas11@… |
Description
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.
Attachments (0)
Change History (3)
comment:1 Changed 14 years ago by Jpm
comment:2 Changed 14 years ago by Valik
- Resolution set to Rejected
- Status changed from new to closed
Absolutely not. What general purpose does this function have to the AutoIt community at large? Why not functions to calculate other religious holidays with similar semantics? There are so many logical reasons why this should be a no.
comment:3 Changed 14 years ago by czardas
I had some reservations about making this request. Thanks for looking into it all the same.
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
I prefer the more general conversion with the ethos 1 to 3 from Oudin
http://www.gmarts.org/index.php?go=415#EasterOudin
I did the AutoIt adaptation and I will commit it, if you agree