[Gambas-user] How to compute Eastern Day
Fabien Bodard
gambas.fr at ...626...
Fri Dec 19 17:32:16 CET 2014
Public Sub Eastern(iYear As Integer) As Date
Dim A, B, C, D, E, F, G As Integer
A = iYear Mod 19 + 1
B = iYear Div 100 + 1
C = (3 * B) Div 4 - 12
D = (8 * B + 5) Div 25 - 5
E = (iYear * 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(iYear, 3, 1), gb.Day, G + 7 - (E + G) Mod 7 - 1)
End
2014-12-19 17:31 GMT+01:00 Fabien Bodard <gambas.fr at ...626...>:
> replace by 'iYear as integer'
>
> Public Sub Eastern(iYear As Integer) As Date
>
> 2014-12-19 16:57 GMT+01:00 T Lee Davidson <t.lee.davidson at ...626...>:
>> 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,
>>>
>>
>> ------------------------------------------------------------------------------
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
> --
> Fabien Bodard
--
Fabien Bodard
More information about the User
mailing list