Nathan de Vries
Committed by Ben Copsey

Use the "en_US_POSIX" locale to ensure 12-hour time settings don't affect the be…

…havior of NSDateFormatter on the iPhone.

Signed-off-by: Ben Copsey <ben@allseeing-i.com>
... ... @@ -24,6 +24,7 @@ static NSDateFormatter *dateFormatter = nil;
+ (void)initialize
{
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'.000Z'"];
}
... ...
... ... @@ -87,7 +87,7 @@ static NSString *sharedSecretAccessKey = nil;
{
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
// Prevent problems with dates generated by other locales (tip from: http://rel.me/t/date/)
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"] autorelease]];
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]];
[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss Z"];
[self setDateString:[dateFormatter stringFromDate:date]];
}
... ...