Calcolo PASQUA

Moderator: Enrico Maria Giordano

Calcolo PASQUA

Postby stefano » Mon Jan 26, 2015 9:19 pm

ciao

Ho trovato questo calcolo per individuare la domenica di Pasqua ...
mi sembra attendibile

cAnno := "2015"
c := Int( Val( cAnno ) / 100 )
n := Int( Val( cAnno ) - ( 19 * Int( Val( cAnno ) / 19 ) ) )
k := Int( ( c - 17 ) / 25 )
i := Int( c - Int( c / 4 ) - Int( ( c - k ) / 3 ) + ( 19 * n ) + 15 )
i := Int( i - ( 30 * Int( i / 30 ) ) )
i := Int( i - ( Int( i / 28 ) * ( 1 - Int( i / 28 ) ) * Int( 29 / ( i + 1 ) ) * Int( ( 21 - n ) / 11 ) ) )
j := Int( Val( cAnno ) + Int( Val( cAnno ) / 4 ) + i + 2 - c + Int( c / 4 ) )
j := Int( j - ( 7 * Int( j / 7 ) ) )
l := Int( i - j )
m := Int( 3 + Int( ( l + 40 ) / 44 ) )
d := Int( l + 28 - ( 31 * Int( m / 4 ) ) )

Pasqua := CtoD( StrZero( d, 2 ) + "/" + StrZero( m, 2 ) + "/" + cAnno )

Saluti
Stefano
FWH 14.11 + xHarbour + bcc582
stefano
 
Posts: 80
Joined: Tue Mar 25, 2008 9:03 pm
Location: ITALIA

Re: Calcolo PASQUA

Postby Enrico Maria Giordano » Tue Jan 27, 2015 12:43 pm

Questa è la funzione che uso io. Gli si può passare un anno o una data.

Code: Select all  Expand view
FUNCTION EASTER( xYear )

    LOCAL nYear := IF( VALTYPE( xYear ) = "D", YEAR( xYear ), xYear )

    LOCAL a := INT( nYear % 19 )
    LOCAL b := INT( nYear / 100 )
    LOCAL c := INT( nYear % 100 )
    LOCAL d := INT( b / 4 )
    LOCAL e := INT( b % 4 )
    LOCAL f := INT( ( b + 8 ) / 25 )
    LOCAL g := INT( ( b - f + 1 ) / 3 )
    LOCAL h := INT( ( 19 * a + b - d - g + 15 ) % 30 )
    LOCAL i := INT( c / 4 )
    LOCAL k := INT( c % 4 )
    LOCAL l := INT( ( 32 + e + e + i + i - h - k ) % 7 )
    LOCAL m := INT( ( a + 11 * h + 22 * l ) / 451 )
    LOCAL n := h + l - 7 * m + 114

    LOCAL nDay   := INT( n % 31 ) + 1
    LOCAL nMonth := INT( n / 31 )

    RETURN CTOD( STRZERO( nDay, 2 ) + "/" + STRZERO( nMonth, 2 ) + "/" + RIGHT( STR( nYear ), 4 ) )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to All products support

Who is online

Users browsing this forum: No registered users and 12 guests