[Gambas-user] How to compute Eastern Day

T Lee Davidson t.lee.davidson at ...626...
Fri Dec 19 16:57:28 CET 2014


When I execute that, I get "Syntax error. The first argument is not a valid identifier" on line "Public Sub Eastern(Year As Integer) As Date".

"Year" is a function.


And did you mean "Easter Day"?


Lee
__________

"Artificial Intelligence is no match for natural stupidity."

On 12/19/2014 08:35 AM, Benoît Minisini wrote:
> Hi,
>
> Here is a little X-Mas gift, a function to compute Eastern Day:
>
> ---8<--------------------------------------------------------------------
>
> Public Sub Eastern(Year As Integer) As Date
>
>     Dim A, B, C, D, E, F, G As Integer
>
>     A = Year Mod 19 + 1
>     B = Year Div 100 + 1
>     C = (3 * B) Div 4 - 12
>     D = (8 * B + 5) Div 25 - 5
>     E = (Year * 5) Div 4 - 10 - C
>     F = ((11 * A + 20 + D - C) Mod 30 + 30) Mod 30
>     If F = 24 Or (F = 25 And A > 11) Then Inc F
>     G = 44 - F
>     If G < 21 Then G = G + 30
>     Return DateAdd(Date(Year, 3, 1), gb.Day, G + 7 - (E + G) Mod 7 - 1)
>
> End
>
> ---8<--------------------------------------------------------------------
>
> I will put it in the 'gb.util' component.
>
> Regards,
>




More information about the User mailing list