0

Processing a date string in the format: June 12, 2014 - 19:35:51 UTC.

NSString * dateStr = @"June 12, 2014 - 19:35:51 UTC";
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
[dateFormatter setDateFormat:@"MMMM dd, yyyy - HH:mm:ss Z"];
NSDate *startTime = [dateFormatter dateFromString: dateStr];

This works perfectly in iOS7, not in iOS6 getting nil.

Thanh-Nhon Nguyen
  • 3,402
  • 3
  • 28
  • 41

1 Answers1

0

Try setting the locale like this:

[dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]];

See this answer.

Community
  • 1
  • 1
Sandy Chapman
  • 11,133
  • 3
  • 58
  • 67