Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSDate*) convertToUTC:(NSDate*)sourceDate
- {
- NSTimeZone* currentTimeZone = [NSTimeZone localTimeZone];
- NSTimeZone* utcTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];
- NSInteger currentGMTOffset = [currentTimeZone secondsFromGMTForDate:sourceDate];
- NSInteger gmtOffset = [utcTimeZone secondsFromGMTForDate:sourceDate];
- NSTimeInterval gmtInterval = gmtOffset - currentGMTOffset;
- NSDate* destinationDate = [[[NSDate alloc] initWithTimeInterval:gmtInterval sinceDate:sourceDate] autorelease];
- return destinationDate;
- }
Add Comment
Please, Sign In to add comment