can someone help me please
I'm trying to create an IOS app using Swift language and I need to use Hijri (islamic) calendar
I tried many time but I failed :(
this is my try
let datenow = NSDate()
let calendar = NSCalendar.currentCalendar()
let components = calendar.components(NSCalendarUnit(UInt.max), fromDate: datenow)
var gregorian = NSCalendar(identifier:NSIslamicCivilCalendar)
var date = gregorian.dateFromComponents(components)
println(date)
and the output is wrong
2576-04-25 09:05:08 +0000
We are in year 1434 in hijri not 2576 !
let hijriCalendar = Calendar(identifier: .islamicCivil)
let formatter = DateFormatter()
formatter.locale = Locale(identifier: "ar")
formatter.calendar = hijriCalendar
formatter.dateFormat = "dd/MM/yyyy"
print(formatter.string(from: Date()))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With