Dear All,
I have a date in milli seconds(EST) and a user specific time zone. I want to convert it to the user specified time zone. Following is the code I tried. Need help:
float val = ([managedObject.lmt_ms floatValue])/(1000.0);
NSDate * dt = [NSDate dateWithTimeIntervalSince1970:val];
NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"PST"];
NSTimeZone* destinationTimeZone = [NSTimeZone timeZoneWithAbbreviation:usrtimezone];
NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:dt];
NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:dt];
NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;
NSDate* destinationDate = [[[NSDate alloc] initWithTimeInterval:interval sinceDate:dt] autorelease];
NSLog(@"Dest time is:%@",destinationDate);