PaulSadowski.com 

Windows Scripting Host
 VBScript To Calculate the Date of Easter
The ever popular what date is Easter script. The script will display the date of Easter for the current year if no argument is given on the command-line, or you can specify the year of interest on the command-line - you can specify multiple years at one time.

Sample output:
  20 April 2003
  1 April 1956


If Wscript.Arguments.Count = 0 Then
  Easter(Year(Now))
else
  For sArg = 0 To Wscript.Arguments.Count -1
    y = Wscript.Arguments(sArg)
    Easter(y)
  next
end if

Sub Easter(y)
Dim c, n, k, i, j, l, m, d
Months = Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" )

c = y\100
n = y - 19 * ( y\19 )
k = ( c - 17 )\25
i = c - c\4 - (c - k)\3 + 19 * n + 15
i = i - 30 * (i\ 30)
i = i - (i\28 ) * (1 - (i\28 ) * ( 29\( i + 1 ) ) * ( ( 21 - n )\11 ) )
j = y + y\4 + i + 2 - c + c\4
j = j - 7 * (j\7 )
l = i - j
m = 3 + (l + 40)\44
d = l + 28 - 31 * (m\4)
Wscript.Echo d, Months(m-1), y
End Sub
 
 

© 2003 by Paul R. Sadowski   
All Rights Reserved. Used By Permission.  
Comments to: Scripting