[Gambas-user] How to compute Eastern Day
T Lee Davidson
t.lee.davidson at ...626...
Fri Dec 19 20:55:23 CET 2014
On 12/19/2014 11:47 AM, Tobias Boege wrote:
> On Fri, 19 Dec 2014, T Lee Davidson wrote:
>> 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,
>>>
>>
>> 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
>
> Never look a gift horse in the mouth :-)
>
I wasn't, Tobi. I was just reporting that there was an error with the subroutine that needed correction.
Lee
__________
"Artificial Intelligence is no match for natural stupidity."
More information about the User
mailing list