Tuesday, 10 September 2013

NSTimeZone timeZoneWithName:@"America/New_York" works not properly

NSTimeZone timeZoneWithName:@"America/New_York" works not properly

The server returns me the right date & time. New York time zone.
2013-09-10 05:37:07 +0000 (the right time, when comment was posted)
Here's how I format it in the app:
[format setDateFormat:@"dd MMM, yyyy HH:mm"];
[format setTimeZone:[NSTimeZone timeZoneWithName:@"America/New_York"]];
And as the result I have
10 sept, 2013 01:37
What's wrong?
UPD
The code
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setTimeZone:[NSTimeZone timeZoneWithName:@"America/New_York"]];
[format setDateFormat:@"dd MMM, yyyy hh:mm"];
NSString *stringDate = [format stringFromDate:Date]; //Date is
"2013-09-10 05:37:07 +0000"

No comments:

Post a Comment