Android Question how to get Hijri Date

Alhootti

Active Member
Im using this variable:

B4X:
Sub GregorianToHijri(TheDate As Long) As List
    Dim jd As Long
    Dim I As Long
    Dim N As Long
    Dim J As Long
 

    Dim D As Long
    Dim M As Long
    Dim Y As Long

    D = DateTime.GetDayOfMonth( TheDate)
    M = DateTime.getMonth(TheDate)
    Y = DateTime.GetYear(TheDate)
    If ((Y > 1582) Or ((Y = 1582) And (M > 10)) Or ((Y = 1582) And (M = 10) And (D > 14))) Then
        jd = Fix((1461 * (Y + 4800 + Fix((M - 14) / 12))) / 4) + Fix((367 * (M - 2 - 12 * (Fix((M - 14) / 12)))) / 12) - Fix((3 * (Fix((Y + 4900 + Fix((M - 14) / 12)) / 100))) / 4) + D - 32075
    Else
        jd = 367 * Y - Fix((7 * (Y + 5001 + Fix((M - 9) / 7))) / 4) + Fix((275 * M) / 9) + D + 1729777
    End If
    I = jd - 1948440 + 10632
    N = Fix((I - 1) / 10631)
    I = I - 10631 * N + 354
    J = (Fix((10985 - I) / 5316)) * (Fix((50 * I) / 17719)) + (Fix(I / 5670)) * (Fix((43 * I) / 15238))
    I = I - (Fix((30 - J) / 15)) * (Fix((17719 * J) / 50)) - (Fix(J / 16)) * (Fix((15238 * J) / 43)) + 29
    M = Fix((24 * I) / 709)
    D = I - Fix((709 * M) / 24)
    Y = 30 * N + J - 30
    Return Array (Y,M,D)
End Sub
Sub Fix(arg As Int) As Int
    Return Ceil(arg )
End Sub

i want when i click the button i will get the day , month and year in hijri date .
there are label1(day), label4(month) and label6(year)

I attached the example for editing

Thank you in advance
 

Attachments

  • Hijri.rar
    434.3 KB · Views: 67
Top