WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time UDFs

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Find Easter

 Keywords:  Easter  Holiday

.

Question:

How can I determine the date Easter falls on in a given year?

Answer:

;Easter finder
;From Scientific American  March 2001
;Easter is a Quasicrystal by Ian Stewart
;Algorithm by Thomas H. O'Beirne of Glasgow
;as originally published in Puzzles and Paradoxes
;(Oxford University Press 1965)

#DefineFunction FindEaster(x)
    X=INT(X)

;1  ;Divide X by 19 to get a quotient (which we ignore) and
    ;a reminader A (This is the year's position in the 19 year
    ;lunar cycle.  (A+1) is the Golden number)
    A=X MOD 19

;2  ;Divide X by 100 to get a quotient B and remainder C
    B=X / 100
    C=X MOD 100

;3  ;Divide B by 4 to get quotient D and remainder E
    D=B/4
    E=B MOD 4

;4  ;Divide (8B+13) by 25 to get quotient G.  Ignore remainder.
     G = ((8*B)+13) / 25

;5  ;Divide 19A+B-D-G+15 by 30 to get a quotient (which we ignore)
    ;and a remainder H (The year's EPACT is 23-H when H is less than 24
    ;and 53-H otherwise)
    H = ((19*A)+B-D-G+15) MOD 30

;6  ;Divide A+11H by 319 to get quotient M and a ignored remainder
    M = (A + (11*H)) / 319

;7  ;Divide C by 4 to get quotient J and remainder K
    J= C/4
    K= C MOD 4

;8  ;Divide 2E+2J-K-H-M+32 by 7 to get a quotient (which we ignore)
    ;and a remainder L
    L = ((2*E)+(2*J)-K-H-M+32) MOD 7

;9  ;Divide H-M+L+90 by 25 to get quotient N and a ignored remainder
    N = (H-M+L+90) / 25

;10 ;Divide H-M+L+N+19 by 32 to get a quotient (which we ignore) and
    ; a remainder P
    P = (H-M+L+N+19) MOD 32

;Easter Sunday is the Pth day of the Nth month 
;(N can be 3=March or 4=April)

    ;Return date in standard Winbatch YYYY:MM:DD:00:00:00 format
    Z=strcat(X,":",strfixleft(N,"0",2),":",strfixleft(P,":",2),":00:00:00")
    return(Z)
   
#endfunction


;Example

while 1
   year=AskLine("Easter Finder","Enter 4 digit year desired","2001")
   easter=FindEaster(year)
   Pause(year,easter)
endwhile

Article ID:   W14750
Filename:   Find Easter.txt
File Created: 2001:03:06:17:18:42
Last Updated: 2001:03:06:17:18:42