protected bool Is_Valid_Date(String date)
{
try
{
DateTime dt = DateTime.Parse(date);
return true;
}
catch
{
return false;
}
}
In above code,if valid date is passed then
DateTime.Parse will parse date and cursor will move to the next line and return true.If we pass any wrong date or pass integer value or string value,then
DateTime.Par se will throw an error and will go in a catch block.