I want to validate if a string is a date, the string I bring from a connection with an API and it comes in the following way
20181025
public static Boolean IsDate(string Expression)
{
Boolean resultado = false;
try
{
DateTime isDate = DateTime.ParseExact(Expression, "dd/MM/yyyy", null);
resultado = true;
}
catch
{
resultado = false;
}
return resultado;
}
but even using the DateTime I can not parse it and the function returns false