NSDate *currentDate = [NSDate date];
//獲取當前時間,日期
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@
"YYYY/MM/dd hh:mm:ss SS"
];
NSString *dateString = [dateFormatter stringFromDate:currentDate];
NSLog(@
"dateString:%@"
,dateString);
這樣就能按照規定的格式顯示日期,時間了。spa
dateString:2015/01/03 08:01:20 24