0

I am trying to convert a string to an NSDate variable and print both the string and date. Because of an error in the date format, it always convert the hour of the string to hour+7 in date.

      let dateFormatter = NSDateFormatter()
      dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZ"
      let date: NSDate = dateFormatter.dateFromString(timeStamp)!

      println("String is is \(timeStamp)")
      println(date)

It prints String is 2015-07-10T16:33:00-07:00 for the first line and 2015-07-10 23:33:00 +0000 for the second line.

How can I resolve this issue?

0 Answers0