Use the DateTime.TryParseExact method in C# for Date Format validation.
They method converts the specified string representation of a date and time to its DateTime equivalent. It checks whether the entered date format is correct or not.
Example
using System;
using System.Globalization;
namespace Demo {
class Program {
static void Main(string[] args) {
DateTime d;
bool chValidity = DateTime.TryParseExact(
"08/14/2018",
"MM/dd/yyyy",
CultureInfo.InvariantCulture,
DateTimeStyles.None,
out d);
Console.WriteLine(chValidity);
}
}
}Output
True