I need to set time in my app. I got time stamp from server (which is GMT) and I need to convert that time stamp into the date, based on the users current time zone. How its possible?
NSDate *date = [[NSDate alloc] initWithTimeIntervalSince1970:@"1340907963"];
NSDateFormatter *dFormat = [[[NSDateFormatter alloc] init] autorelease];
[dFormat setDateStyle:NSDateFormatterMediumStyle];
[dFormat setDateFormat:@"d.MM.yyyy"];
NSString *theDate = [dFormat stringFromDate:date];
This is how I converted the time stamp in to date. And I got an out put some thing like 20 June 2012 23:55. But my actual time is 18:55
The value you received is unix time (interval since 1970) to convert it use
Then to convert it to string