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();