Return to Snippet

Revision: 46712
at May 23, 2011 21:24 by paki


Initial Code
- (NSDate*)getLocalTime:(NSDate*)sourceDate
{
	NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
	NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];
	
	NSInteger sourceGMTOffset = [sourceTimeZone secondsFromGMTForDate:sourceDate];
	NSInteger destinationGMTOffset = [destinationTimeZone secondsFromGMTForDate:sourceDate];
	NSTimeInterval interval = destinationGMTOffset - sourceGMTOffset;
	
	NSDate* destinationDate = [[[NSDate alloc] initWithTimeInterval:interval sinceDate:sourceDate] autorelease];
	return destinationDate;
}

Initial URL

                                

Initial Description

                                

Initial Title
Get Local Phone Time

Initial Tags

                                

Initial Language
Objective C