Using NSDateFormatter to format date to local date
I have tried numer开发者_StackOverflow中文版ous attemps of formatting a relatively simple date format to a date object, but also converting to my local time zone.
All dates are formatte like this: 2010-09-11T08:55:00
. This is GMT time, and I want it converted to a date object with GMT+2.
Can anyone please point me in the right direction?
I just figured out how to format the date:
NSString *str = @"2010-09-10T18:24:43";
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss"];
NSDate *date = [format dateFromString:str];
[format setDateFormat:@"EEEE MMMM d, YYYY"];
str = [format stringFromDate:date];
[format release];
NSLog(@"%@", str);
Just need to convert to local timezone now..
精彩评论