GMT-Zeitzone Umwandlung in objective c

Ich versuche zu konvertieren, nsstring, nsdate und dann auf die systemtimezone. Ist mein code richtig? Jede Hilfe zu schätzen.

NSString *str=@"2012-01-15 06:27:42";

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehaviorDefault];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *dateFromString = [dateFormatter dateFromString:str];

NSDate* sourceDate = dateFromString;

NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT-07:00"];
NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];

NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:sourceDate];
NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:sourceDate];
NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;

NSDate* destinationDate = [[[NSDate alloc] initWithTimeInterval:interval sinceDate:sourceDate] autorelease];

bottomLabel2.text=[NSString stringWithFormat:@"- %@ -",destinationDate];

Den code Ergebnis ist 2012-01-15 06:27:42 +0000 das ist das gleiche wie die Quelle!

"Ist mein code richtig?" ist die Frage nicht zu Fragen, hier. codereview.stackexchange.com
Ich glaube nicht, dass der original-poster ist zu Fragen, für ein review, aber vielleicht nicht deutlich gesagt das problem. Jedenfalls habe ich beantwortet.

InformationsquelleAutor stefanosn | 2012-01-15

Schreibe einen Kommentar