Wednesday, December 31, 2008

Varicose Veins Ceragem

ASP - Calculate the day Easter

In this post I will show how to calculate the day of the Passover from a year ago.

This is a very simple ASP function which spend a year or a date.

function is this:


\u0026lt;%
'script for the calculation of Easter
' Author: Mark Brunelli - www.giuba.it
calcolapasqua function (date)
dim X, A, B, C, D, E, F, G, H, M, J, K, L, N, P, Pday
if IsDate (date) then
'if I had a date
X = year (date)

else' if I spent a number
X=data
    end if
    'calcolo la pasqua
    A=X mod 19
    B= int(X/100)
    C=X mod 100
    D=int(B/4)
    E=B mod 4
    G=int((8*B+13)/25)
    H=(19*A+B-D-G+15)mod 30
    M=int((A+11*H)/319)
    J=int(C/4) K=C mod 4
    L=(2*E+2*J-K-H+M+32) mod 7
    N=int((H-M+L+90)/25)
    P = (H + L-M + N +19) mod 32
Pday = P & "/" & N & "/" & X
calcolapasqua = FormatDateTime (Pday, 1)

end function%> ;


Just pass the function a year (positive integer) or date and this will "shoot out" the day of the Passover!
If you do not want to see the day (Sunday) as a result of the function, put this in the penultimate line

calcolapasqua = FormatDateTime (Pday)

instead of

calcolapasqua = FormatDateTime (Pday, 1)


Or look for a guide to the asp function 'FormatDateTime'!

Attention to pass correct values \u200b\u200bto the function. This time I did not do error checking!

as usual for the lazy links or zippino with the script already!