B4A Library Hijri Converter (Gregorian to Hijri and vice versa)

Discussion in 'Additional libraries, classes and official updates' started by somed3v3loper, Apr 6, 2015.

  1. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Hello everyone

    Here is a small library to convert Gregorian date to Hijri (Islamic) calendar and vice versa.

    The result is a list of day,month,year,name of month

    Please note that this library does some calculations to convert to Hijri and vice versa so results can differ from real date (Usually one day earlier or one day later )



    HijriConverter
    Author:
    SMM
    Version: 0.01
    • HijriConverter
      Methods:
      • GregorianToHijri (Year As Int, Month As Int, Day As Int) As List
        Returns Hijri date as a list
        (day,month,year,nameofmonth)
        Note:
        This library just does some calculation that sometimes differ from real moon-related calendar
      • HijriToGregorian (Year As String, Month As String, Day As Int) As List
      • TodayGregorianToHijri As List
        Quick way for getting today's Hijri date
     

    Attached Files:

  2. rleiman

    rleiman Well-Known Member Licensed User

    Assalam alaikum,

    Ramadan mubarak.

    I'm sure I will find this one useful.
     
    aazizz likes this.
  3. Beja

    Beja Expert Licensed User

    somed3v3loper
    Salam and Ramadan Mubarak
    Thanks so much.. will try it in a dual Gregorian/Hijri calendar project.

    I assume you already provided for the year 650 AD
     
  4. ArminKH

    ArminKH Well-Known Member

    thank u i will test it tonight
     
  5. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    I don't think I understand your point regarding 650 AD .
    Please check and tell us .

    If the Gregorian date is prior to the start of Hijri , it will return negative value .
     
  6. rad

    rad Member Licensed User

    Assalamualaikum, can anyone give me an example how to use this library....
     
  7. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Waalaikum Assalam
    Code:
    Dim hijri As List=HijriConverter.GregorianToHijri(2016,03,23 )
       
        
    Log("Day is: "&hijri.Get(0))
        
    Log("Month is: "&hijri.Get(1))
        
    Log("Year is: "&hijri.Get(2))
        
    Log("Name of month is : "&hijri.Get(3))
     
  8. rad

    rad Member Licensed User

    Hi somed3v3loper, thanks for your quick response

    I have trying your given example above, but I dont know how, my application automatically quit without any alert message.
    This is my script:
    Dim hijri As List=HijriConverter.GregorianToHijri(2016,03,23 )
    lblHijri.Text= hijri.Get(0) & "/" & hijri.Get(1) & "/" & hijri.Get(2) & ", " & hijri.Get(3)

    Notes: I just a beginner...
     
  9. rad

    rad Member Licensed User

    Hi somed3v3loper, thanks for your quick response

    I have trying your given example above, but I dont know how, my application automatically quit without any alert message.
    This is my script:
    Dim hijri As List=HijriConverter.GregorianToHijri(2016,03,23 )
    lblHijri.Text= hijri.Get(0) & "/" & hijri.Get(1) & "/" & hijri.Get(2) & ", " & hijri.Get(3)

    Notes: I just a beginner...
     
  10. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    I got this when logging hijri.Get(0) & "/" & hijri.Get(1) & "/" & hijri.Get(2) & ", " & hijri.Get(3)
    Do you have DateUtils library ?
     
  11. rad

    rad Member Licensed User

    I use B4A V.3.8, and the result as a I said before...
    And then I purchare B4A V.5.8 and your Library is running well...

    Thanks you so much for the library and your support for me as a beginner...;)
     
  12. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    You are welcome I am still a beginner :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice