「Objective-C」ios開発で現在時刻を取得する

方法1
NSDateFormatter*formatter = [[NSDateFormatteralloc] init];
[formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];
NSString *locationString=[formatter stringFromDate: [NSDate date]];

方法2
-(NSString *)getDate
{
NSDateFormatter*formatter = [[NSDateFormatteralloc] init];
[formatter setDateFormat:@"yyyy-MM-dd EEEE HH:mm:ss a"];
NSString *locationString=[formatter stringFromDate: [NSDate date]];
[formatter release];
return locationString;

IOS

Posted by arkgame