Skip to content

String Date Validator

String Date Validator

Mark Wagner has a nice helper function for validating a date.

private static bool IsDate(string sDate)
{
DateTime dt;
bool isDate = true;

try
{
dt = DateTime.Parse(sDate);
}
catch
{
isDate = false;
}

return isDate;
}