判断时间格式时12小时制还是24小时制
+(BOOL)timeIs24HourFormat { NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateStyle:NSDateFormatterNoStyle]; [formatter setTimeStyle:NSDateFormatterShortStyle]; NSString *dateString = [formatter stringFromDate:[NSDate date]]; NSRange amRange = [dateString rangeOfString:[formatter AMSymbol]]; NSRange pmRange = [dateString rangeOfString:[formatter PMSymbol]]; BOOL is24Hour = amRange.location == NSNotFound && pmRange.location == NSNotFound; [formatter release]; return is24Hour;}?