I found these functions (in VB) that calculates easter day, but I could not convert to B4A (I tried but don't worked):
http://www.cpearson.com/excel/easter.aspx
http://www.codeproject.com/Tips/6630/Computing-Easter-Date-VB-Function
I tried to convert this function made in Delphi...
to this:
but did not work too.
The easter sunday in 2015 is April 5 and in 2016 is March 27.
I appreciate any help to make this function works.
http://www.cpearson.com/excel/easter.aspx
http://www.codeproject.com/Tips/6630/Computing-Easter-Date-VB-Function
I tried to convert this function made in Delphi...
B4X:
function GetGoldenNumber (const Year: Word): Integer;
begin
Result := Year mod 19 + 1;
End;
function GetEasterSunday (const Year: Word): TDateTime;
var
C, I, J, H, G, L: Integer;
D, M: Word;
begin
G := GetGoldenNumber (Year) - 1;
C := Year div 100;
H := (C - C div 4 - (8 * C + 13) div 25 + 19 * G + 15) mod 30;
I := H - (H div 28) * (1 - (H div 28) * (29 div (H + 1))*((21 - G) div 11));
J := (Year + Year div 4 + I + 2 - C + C div 4) mod 7;
L := I - J;
M := 3 + (L + 40) div 44;
D := L + 28 - 31 * (M div 4);
Result := EncodeDate (Year, M, D);
End;
to this:
B4X:
Sub GetGoldenNumber (Year As Long) As Int
Return Year Mod 19 + 1
End Sub
Sub GetEasterSunday (Year As Long) As Long
Dim C, I, J, H, G, L As Int
Dim D, M As Long
G = GetGoldenNumber(Year) - 1
C = Year / 100
H = (C - C / 4 - (8 * C + 13) / 25 + 19 * G + 15) Mod 30
I = H - (H / 28) * (1 - (H / 28) * (29 / (H + 1))*((21 - G) / 11))
J = (Year + Year / 4 + I + 2 - C + C / 4) Mod 7
L = I - J
M = 3 + (L + 40) / 44
D = L + 28 - 31 * (M / 4)
Return DateTime.DateParse(M & "/" & D & "/" & Year)
End Sub
Label1.Text = DateTime.Date(GetEasterSunday(EditText1.Text))
but did not work too.
The easter sunday in 2015 is April 5 and in 2016 is March 27.
I appreciate any help to make this function works.