DateFormatter for format 'Fri, 19 Jun 2015 20:05:23 GMT'

159 views Asked by At

I am trying to determine the DateFormatter dateFormat element for the following timestamp:

Fri, 19 Jun 2015 20:05:23 GMT

I have tried the following without success:

E', dd MMM yyyy hh:mm:ss zzz
EE', dd MMM yyyy hh:mm:ss zzz
EEE', dd MMM yyyy hh:mm:ss zzz

E', dd MMM yyyy hh:mm:ss zz
EE', dd MMM yyyy hh:mm:ss zz
EEE', dd MMM yyyy hh:mm:ss zz
1

There are 1 answers

1
Ruchish Shah On BEST ANSWER
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"]];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]];

// "Fri, 19 Jun 2015 20:05:23 GMT"
[dateFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss zzz"];