Get current time [duplicate]
Possible Duplicate:
Retrieving current local time on iPhone?
How to get current time ?(hour:minute:second)
NSDate *now = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"hh:mm:ss";
[dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];
NSLog(@"The Current Time is %@",[dateFormatter stringFromDate:now]);
[dateFormatter release];
精彩评论