I'm initializing my NSDateFormatter thusly:
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease]];
[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss z"];
[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
NSDate *date = [NSDate date];
NSString *dateString = [dateFormatter stringFromDate:date];
dateString
is now:
Thu, 29 Jul 2010 14:58:42 GMT+00:00
I want to get rid of the "+00:00"
I'm guessing from http://unicode.org/reports/tr35/tr35-6.html#Time_Zone_Fallback that I might have a localization issue. I'm working around this right now by removing the "+00:00" manually, but that isn't ideal.
EDIT
I tried a couple of new ways to create the NSTimeZone, but they both produce the same dateString
:
[NSTimeZone timeZoneWithName:@"GMT"];
[NSTimeZone timeZoneWithName:@"UTC"];
[NSTimeZone timeZoneWithAbbreviation:@"GMT"];
[NSTimeZone timeZoneWithAbbreviation:@"UTC"];