We need not load the entire Microsoft.VisualBasic.Information.IsDate() for this function alone...
We can use the following the basepage
public static bool IsDate(object Expression)
{
string strDate = Expression.ToString();
try
{
DateTime dt = DateTime.Parse(strDate);
if (dt != DateTime.MinValue && dt != DateTime.MaxValue)
return true;
return false;
}
catch
{
return false;
}
}
Friday, August 31, 2007
Subscribe to:
Post Comments (Atom)
1 comment:
I believe you should by using TryParse instead of Parse. TryParse does not raise an exception.
Post a Comment