//獲取當前日期 NSDate* date = [NSDate date]; NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"HH:mm"]; NSString* dateStr = [dateFormat stringFromDate:date]; NSLog(@"當前時間%@",dateStr);