/OKPersianDate-swift

get Persian - Jalali - Shamsi date with Swift with core calendar of iOS called NSCalendar

Primary LanguageSwift

OKPersianDate-swift

How its work :

let date = NSDate()
let calender = NSCalendar(calendarIdentifier: NSCalendarIdentifierPersian)
let components = calender?.components(NSCalendarUnit(UInt.max), fromDate: date)

let year =  components!.year
let month = components!.month
let day = components!.day

txtDate.text = "\(year)/\(month)/\(day)"