// 현재 날짜와 시간.
NSDate *now = [[NSDate alloc] init];
 
// 날짜 포맷.
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd"];
 
// 시간 포맷.
NSDateFormatter *timeFormat = [[NSDateFormatter alloc] init];
[timeFormat setDateFormat:@"HH:mm:ss"];
 
NSString *theDate = [dateFormat stringFromDate:now];
NSString *theTime = [timeFormat stringFromDate:now];
NSString *updated = @"Updated: ";
updated = [updated stringByAppendingString:theDate];
updated = [updated stringByAppendingString:@" "];
updated = [updated stringByAppendingString:theTime];
 
NSLog(@"Updated: %@", updated);
 
[dateFormat release];
[timeFormat release];
[now release];


반응형