I am getting the current UTC NSDate and converting it to the timezone of the device. when it is converted to string, the output is correct and is according to the device timezone. But when I convert the string back to NSDate object, the output is again shown in UTC.
Here is the code I am trying
let date = NSDate.date()
let formatter: NSDateFormatter = NSDateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let timezone = NSTimeZone.systemTimeZone()
formatter.timeZone = timezone
let currentDate: String = formatter.stringFromDate(date)
let cd:NSDate = formatter.dateFromString(currentDate)!
I need to compare another date with the current date of user's device.
Any help will be highly appreciated. Thank you in advance.