Validating dates in dd-MMM-yyyy format [Tip/Trick]
Posted: 13 May 2010
Updated: 13 May 2010
Rating: 4.98/5
Votes: 30
Popularity: 7.35
Licence: The Code Project Open License (CPOL)
Bookmarked: 4
Downloaded: 0
Less magic, more readable, would be:DateTime dt1;DateTime dt2;if (DateTime.TryParseExact(str1, "dd-MMM-yyyy", null, DateTimeStyles.None, out dt1) && DateTime.TryParseExact(str2, "dd-MMM-yyyy", null, DateTimeStyles.None, out dt2)) { // do something with those datetimes}