try
{
Convert.ToDataTime(......)
}
catch
{
//........
}

解决方案 »

  1.   

    using System;public static bool IsDate (String str)
    {
        DateTime date;
        bool bGood = false;
        try
        {
            date = Convert.ToDateTime(str);
            bGood = true;
        }
        catch(SystemException e)
        {
        }   return bGood;
    }orpublic static bool IsDate(string date) {
        DateTime dt;
        bool isDate = true;
        try 
        {
          dt = DateTime.Parse(date);  
        }
        catch (FormatException e) 
        {
          isDate = false;
        }     return isDate;
      }