string dateInput = "1/1/2022"; DateTime date; if ( DateTime.TryParse(dateInput, out date) ) { Console.WriteLine("Success"); } else { Console.WriteLine("Fail"); }