Answer the question
In order to leave comments, you need to log in
Problem with timezones in NSDate?
From different rss I get dates in different time zones, I need to display them in the user's zone [NSTimeZone systemTimeZone].
How to do it right?
Tried like this:
- (NSDate *)convertDate:(NSString *)date
{
NSString *dateFormat = @"EEE, dd MMMM yyyy HH:mm:ss zzz";
NSDateFormatter *dateFormatter = ;
[dateFormatter setDateFormat:dateFormat];
NSLog(@"%@ --- %@", date, [dateFormatter dateFromString:date]);
return [dateFormatter dateFromString:date];
}
- (id)init
{
[self convertDate:@"Sat, 02 Nov 2013 15:58:00 PDT"];
[self convertDate:@"Fri, 27 Sep 2013 11:26:22 +0400"];
}
Sat, 02 Nov 2013 15:58:00 PDT --- 2013-11-02 22:58:00 +0000
Fri, 27 Sep 2013 11:26:22 +0400 --- 2013-09-27 07:26:22 +0000
Answer the question
In order to leave comments, you need to log in
Everything is working correctly for you.
NSLog always displays the date in the GMT zone.
Please note that in your second case 11:26 +04:00 is the same time as 07:26 +00:00
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question