How to convert time to the time zone of the iPhone device?

How to convert time to the time zone of the iPhone device?

I have a time in EST timezone, it is done using the NOW() function on the mysql server. Because my server is located in EST, the time stored is in EST. When I retrieve it from my app on the iPhone, I need to display it in the correct time zone of the user. How do I do that?

Image getting pixelated when used as part of an animation in iPhone animation


UITableView Animation Headache
I think it depends on what you mean by EST - if you mean East Coast US, then in general, that is 5 hours behind UTC (but not accounting for daylight saving), which should give you 04:00 EST.

iPhone OpenGL ES incorrect alpha blending
Try to avoid using abbreviations where possible, as they are ambiguous, e.g.

Does a NSURLConnection retain its delegate?
EST is the abbreviation for both America/Detroit and Australia/Sydney.

Which button was tapped… iPhone and Obj-C question
Using NSTimeZone initWithName will give more precise results.

Can UILabel's drawTextInRect method be overridden to change the size of UILabel's text?
The Chronos Time Zone Repository provides a nicely readable XML timezone database that really helps in understanding how time zones work (it's all rather messy and changeable)..
Attaching another modem to an iPhone or gPhone


//You can use the below function to convert date to a time zone you wish.
+ (NSDate *) convertDate:(NSDate *) date toTimeZone:(NSString *) timeZoneAbbreviation {      NSTimeZone *systemZone  = [NSTimeZone systemTimeZone];     NSTimeZone *zoneUTC     = [NSTimeZone timeZoneWithAbbreviation:timeZoneAbbreviation];     NSTimeInterval s        = [zoneUTC secondsFromGMT];      NSTimeZone *myZone      = [NSTimeZone timeZoneWithAbbreviation:[systemZone abbreviationForDate:date]];     NSTimeInterval p        = [myZone secondsFromGMT];      NSTimeInterval i = s-p;     NSDate *d = [NSDate dateWithTimeInterval:i sinceDate:date];      return d;  }   //Test case **note** cgUtil is the class this method is written thus change it accordingly  __block NSDate *now = [NSDate date]; NSLog(@"Current time:%@", now); [[[NSTimeZone abbreviationDictionary] allKeys] enumerateObjectsUsingBlock:^(NSString * abb, NSUInteger idx, BOOL *stop) {     NSLog(@"Time zone abb:%@:Time:%@",abb,[cgUtil convertDate:now toTimeZone:abb]); }]; 

74 out of 100 based on 49 user ratings 724 reviews