The source code is come from
Hijri (islamic) calendar in swift التاريخ الهجري
How can I convert string date to NSDate?
I just put them together but it has some mistake with the output
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "YYYY-MM-DD"
let GregorianDate = dateFormatter.dateFromString("\(Yeartext1.text!)-\(Monthtext1.text!)-\(Daytext1.text!)")
let islamic = NSCalendar(identifier: NSIslamicCalendar)
let components = islamic?.components(NSCalendarUnit(rawValue: UInt.max), fromDate: GregorianDate!)
resultlable.text = "\(components!.year) - \(components!.month) - \(components!.day)"
For Example , the user will enter a gregorian date (2015/09/29) and it will show the Hijri year (1436/12/15) .
but the result in this code is wrong .
SO , Please help .
Thanks a lot for x4h1d (https://stackoverflow.com/users/1459192/x4h1d) , Grimxn (https://stackoverflow.com/users/3729417/grimxn) and for everyone for help .