[Gambas-user] How to compute Eastern Day

Benoît Minisini gambas at ...1...
Fri Dec 19 14:35:48 CET 2014


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,

-- 
Benoît Minisini




More information about the User mailing list