//现在时间time 要比较的时间time1 NSTimeInterval = [[NSDate date] timeIntervalSince1970]; NSTimeInterval time1 = [selectedDate timeIntervalSince1970]; if (time1
//时间格式化-(NSString *)getDateAccordingTime:(NSString *)aTime formatStyle:(NSString *)formate{ NSDate *nowDate = [NSDate dateWithTimeIntervalSince1970:[aTime intValue]]; NSDateFormatter* formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:formate]; return[formatter stringFromDate:nowDate];} _timeLabel.text = [self getDateAccordingTime:_model.time formatStyle:@"YYYY-MM-dd HH:mm:ss"];
#pragma mark-正则表达式验证手机号-(BOOL)isValiadateMobile:(NSString *)mobile{ NSString *phoneRegex=@"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$"; NSPredicate *phoneTest=[NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex]; return [phoneTest evaluateWithObject:mobile];} if (![self isValiadateMobile:_telephoneTextField.text]) { UIAlertView*alert = [[UIAlertView alloc]initWithTitle:@"请输入有效的联系人电话" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil]; [alert show]; return; }