1
votes

This is the date format I'm getting back from the server:

Tue Apr 05 2016 23:59:00 GMT-0700 (PDT)

This is what I have so far: "EEE MMM dd yyyy HH:mm:ss 'GMT'Z (zzz)"

Which characters are having trouble parsing?

1

1 Answers

0
votes

Date format should be the following:

"EEE MMM dd yyyy HH:mm:ss 'GMT'ZZZZ (zzz)"

Demo:

let dateString = "Tue Apr 05 2016 23:59:00 GMT-0700 (PDT)"
let formatter = NSDateFormatter()
formatter.dateFormat = "EEE MMM dd yyyy HH:mm:ss 'GMT'ZZZZ (zzz)"

let date = formatter.dateFromString(dateString)
print(date)
>>> Optional(2016-04-06 06:59:00 +0000)