How do I get current year as string in Obj-C ?
Also how do I compare the same using another year value ?
Is it advisable to do a string comparision OR dirctly ye
In Swift you can get only year by given code
let formatter = NSDateFormatter() formatter.dateFormat = "yyyy" let dateStr = formatter.stringFromDate(NSDate()) print(dateStr)
Output:
2017