It’s pretty common to see a timestamp like this
2001-07-04T12:08:56-07:00
supplied by xml and json feeds.
I’m pretty sure this is because one of the relatively common date formats supported by Java is
yyyy-MM-dd’T’HH:mm:ssXXX
and as we all know, Java and the internet are besties.
Thing is, NSDateFormatter doesn’t know what to do with XXX time zone formats, because it’s based on unicode date formatting and XXX is ISO 8601.
Yay for standards!
Lucky for us we know two things worth knowing
- there aren’t half time zones
- time format string can escape segments with single quotes
so our date format string for our formatter becomes
yyyy-MM-dd’T’HH:mm:ssZZ’:00’
and we’re off to the races.
Everybody’s happy. Except possibly all those people writing Java.
(Insert your own joke about porn in the app store and XXX time, or maybe something about how our evil Cupertino overlords are censoring our time formatters!)