I have this time format 2016-09-06T12:44:00.118Z
What is the correct format for NSDateformatter? With below format it doesn't seems to be calculating the correct time.
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
This last 118Z part of the date string is probably the time zone. So What dateFormat could be used here instead .SSSZ ?
I couldn't find a way to construct a proper formatter string with the help of this,
Try this...
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
dateFormatter.timeZone = NSTimeZone(name: "UTC")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.