NSDateFormatter替代

struct tm  sometime;

const char *formatString = "%Y-%m-%d %H:%M:%S %z";

(void) strptime_l("2005-07-01 12:00:00 -0700", formatString, &sometime, NULL);

NSLog(@"NSDate is %@", [NSDate dateWithTimeIntervalSince1970: mktime(&sometime)]);

// Output: NSDate is 2005-07-01 12:00:00 -0700


你可能感兴趣的:(NSDateFormatter替代)