Use NSDateFormatter . The following is a brief example:
... NSString* dateString = "2011-08-12T12:20:00Z"; NSDateFormatter* fmt = [NSDateFormatter new]; [fmt setDateFormat:"yyyy-MM-dd'T'HH:mm:ss'Z'"]; NSDate* date = [fmt dateFromString:dateString]; [fmt release]; ...
Note that according to Unicode Technical Standard # 35 , NSDateFormatter does not support single-letter time zone identifiers (i.e. Z for zulu time).
source share