Esempio n. 1
0
 /// <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);
     }
 }
Esempio n. 2
0
 /// <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);
     }
 }