![](/img/Ben-cartoon-150px.png)
Validate Value is a date
Convenient way to DateTime.TryParse into a DateTime
public static bool IsDate(this string input)
{
if (!string.IsNullOrEmpty(input))
{
return DateTime.TryParse(input, out _);
}
else
{
return false;
}
}
Returns true/false - call like this...
DateToCheck.IsDate();