I am trying to format an existing date in my project. Also, I am using localTimeZone to format date. However, it returns UTC and does not give correct date. Here is my code:
var dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
dateFormatter.timeZone = NSTimeZone.localTimeZone()
bagItem.date = dateFormatter.dateFromString(dateFormatter.stringFromDate(self.selectedDateForAdmin))
After the code above during debugging, for instance; today is 21-04-2015. However, it returns 20-04-2015. The actual question is that Why NSTimezone.localTimeZone() does not return correct date? Also, why returns UTC? I live in Turkey and timezone should be GMT. Please help me. This is a huge problem for my project.
Best regards