Created
May 31, 2013 15:14
-
-
Save katsuhide/5685660 to your computer and use it in GitHub Desktop.
ローカル時刻を取得するようにNSDateを拡張
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface NSDate (Util) | |
- (NSDate*)toLocalTime; | |
@end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NSDate+Util.h" | |
@implementation NSDate (Util) | |
- (NSDate*)toLocalTime{ | |
NSTimeZone *tz = [NSTimeZone defaultTimeZone]; | |
NSInteger seconds = [tz secondsFromGMTForDate: self]; | |
return [NSDate dateWithTimeInterval: seconds sinceDate: self]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment