Created
May 13, 2009 03:49
-
-
Save akio0911/110868 to your computer and use it in GitHub Desktop.
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 <Cocoa/Cocoa.h> | |
int main(){ | |
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
NSLog(@"Hello"); | |
NSDate *now = [[NSDate date] retain]; | |
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
//ロケールを設定 | |
[dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"ja_JP"] autorelease]]; | |
[dateFormatter setDateFormat:@"hh:mm:ss"]; | |
NSString *formattedDate = [dateFormatter stringFromDate:now]; | |
NSLog(@"%@", formattedDate); | |
[dateFormatter setDateFormat:@"HH:mm:ss"]; | |
formattedDate = [dateFormatter stringFromDate:now]; | |
NSLog(@"%@", formattedDate); | |
[dateFormatter setDateFormat:@"KK:mm:ss"]; | |
formattedDate = [dateFormatter stringFromDate:now]; | |
NSLog(@"%@", formattedDate); | |
[dateFormatter setDateFormat:@"kk:mm:ss"]; | |
formattedDate = [dateFormatter stringFromDate:now]; | |
NSLog(@"%@", formattedDate); | |
[pool release]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment