NSDateFormatter date format for a date / time with a colon in the time zone

I have a problem converting a date / time string to NSDate.

Date string I need to convert: 2002-12-24T00: 00: 00-07: 00

My date format string is currently yyyy-MM-dd'T'HH: mm: ssZZZ

The problem is that the colon is in the time zone.

ZZZ returns a string like: -0700 (without a colon) How do I convert a colon string to a time zone?

thank

+5
source share
1 answer

, , dateWithString - stringByReplacingOccurrencesOfString , ?

dateWithString :

YYYY-MM-DD HH:MM:SS ±HHMM

:

yyyy-MM-dd'T'HH:mm:ssZZZ

, , SeparatedByString ( "", T , , ssZZZ + HHMM.

+3

All Articles