TryParse
string datestring = "01/01/0001"; DateTime date; if (DateTime.TryParse(datestring, out date)) { // Date parsed ok. All good. } else { // Could not parse datestring or the date is out of range. // Tell the user to try other input }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)