iOS Question Convert Gregorian date to Islamic date

Discussion in 'iOS Questions' started by Pooya1, Dec 5, 2018.

  1. Pooya1

    Pooya1 Active Member Licensed User

    Hi
    I want to convert Gregorian date to Islamic date
    I found below code in stackoverflow if it is right code
    That is simple code but i dont know how do use it in B4i

    Code:
    let dateFormatter = NSDateFormatter()
    dateFormatter.dateFormat = 
    "dd-MM-yyyy"
    let GregorianDate = dateFormatter.dateFromString(
    "\(Daytext1.text!)-\(Monthtext1.text!)-\(Yeartext1.text!)")
    let islamic = NSCalendar(identifier: NSCalendarIdentifierIslamicUmmAlQura)
    let components = islamic?.components(NSCalendarUnit(rawValue: UInt.max), fromDate: GregorianDate!)
    resultlable.text = 
    "\(components!.year) - \(components!.month) - \(components!.day)"
    https://stackoverflow.com/questions/32893323/convert-gregorian-date-to-hijri-date
     
    Last edited: Dec 5, 2018
  2. Ohanian

    Ohanian Active Member Licensed User

  3. Pooya1

    Pooya1 Active Member Licensed User

    I need Hijri date from 1400 year
     
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