Skip to content

Instantly share code, notes, and snippets.

@akio0911
Created May 13, 2009 03:49
Show Gist options
  • Save akio0911/110868 to your computer and use it in GitHub Desktop.
Save akio0911/110868 to your computer and use it in GitHub Desktop.
#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