/// <summary> /// 判断是否是正确的日期格式 /// </summary> /// <param name="input"></param> /// <returns></returns> public static bool IsDate(object obj) { try { DateTime.Parse(StrUtil.GetStr(obj)); return(true); } catch { return(false); } }
/// <summary> /// 强制转化为整形,非数字时返回99999 /// </summary> /// <param name="input"></param> /// <returns></returns> public static int ToInt2(object input) { try { if (StrUtil.GetStr(input).Equals(string.Empty)) { return(99999); } return(Convert.ToInt32(input)); } catch { return(99999); } }