I'm trying to print a human-friendly date that's of a different calendar identifier. I am able to get the date, but when I format it, it outputs back to Gregorian (or the user's current calendar I think).
Here's what I'm trying:
var calendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierIslamicCivil)
var flags = NSCalendarUnit(UInt.max)
var components = calendar?.components(flags, fromDate: NSDate())
let formatter = NSDateFormatter()
formatter.dateStyle = NSDateFormatterStyle.LongStyle
let dateString = formatter.stringFromDate(calendar!.dateFromComponents(components!)!)
println(dateString)
This prints: May 8, 2015
, but I'm trying to get it to print Rajab 19, 1436
. Is this possible?