I’m using this code to convert a string to a date :
+(NSDate*)dateTexteFromString:(NSString*)someString
{
NSDateFormatter *df = [[NSDateFormatter alloc] init];
NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"] autorelease];
[df setLocale:locale];
[df setDateFormat:@"EEE, dd MMM yyyy hh:mm a zzz"];
NSDate *myDate = [df dateFromString: someString];
[df release];
return myDate;
}
It works fine for most dates, but this one drives me crazy:
Tue, 12 Jul 2011 12:28 am MSD
(Moscow). What should I do? And is there other unrecognized timezone like this one? I can’t try all timezones over the world 🙁
Use MSKS instead of MSD or find what you need by doing this:
First find the available time zone names using
Then copy the name that you want (i copied Europe/Moscow) and use this code to find the abbreviation