title: Get current iPhone device timezone date and time from UTC-5 timezone date and time iPhone app?
body: <p>In my iPhone application i am very struggling to convert the webservice response time to current device time. The <code>webservice time in UTC-5 timezone</code>. The app is worldwide use app. So i have to convert the response time to current device timezone. This is simple messaging app.</p>
  
  <p>When i have sent a <code>message the time is "5:05 PM" (India Chennai timezone)</code> but when am retrieve time <strong>from <code>webservice is "2012-07-16 07:33:01"</code></strong>. When i show the time in the app i should convert the time to device's local time. I have tried in some way but i can't solve yet. Code is:</p>
  
  <pre><code>NSDateFormatter *dateFormatter1 = [[NSDateFormatter alloc] init]; 
  [dateFormatter1 setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; 
  [dateFormatter1 setLocale:[NSLocale currentLocale]];
  //[dateFormatter1 setTimeZone:[NSTimeZone timeZoneWithName:@"IST"]];
  [dateFormatters setTimeZone:[NSTimeZone systemTimeZone]];
  NSDate *date = [dateFormatter1 dateFromString:dateStr];
  NSLog(@"date : %@",date);
  </code></pre>
  
  <p>But the output date and time is <code>2012-07-16 02:03:01 +0000</code> I have stored this date/time in <code>Coredata</code> and when I have retrieve from <code>CoreData</code> and covert to <code>NSString</code> using the below code,</p>
  
  <pre><code>NSDateFormatter *dateFormatters = [[NSDateFormatter alloc] init];
  [dateFormatters setDateFormat:@"dd-MMM-yyyy hh:mm"];
  [dateFormatters setDateStyle:NSDateFormatterShortStyle];
  [dateFormatters setTimeStyle:NSDateFormatterShortStyle];
  [dateFormatters setDoesRelativeDateFormatting:YES];
  [dateFormatters setTimeZone:[NSTimeZone systemTimeZone]];  
  dateStr = [dateFormatters stringFromDate:dateString];
  NSLog(@"DateString : %@", dateStr);
  </code></pre>
  
  <p>The output date and time is "<code>Today 7:33 AM</code>". It should be show "<code>Today 5:05 PM</code>". Can anyone please save my day? Please help to solve this issue. Thanks in advance.</p>