Benny Sutton is 4 hire - just click here
Extension method to wrap DateTime.TryParse
Wrapper for DateTime.TryParse returns false or new DateTime
public static DateTime? ToDateTime(this string s)
{
DateTime dtr;
var tryDtr = DateTime.TryParse(s, out dtr);
return (tryDtr) ? dtr : new DateTime?();
}
simply call like this...
str.ToDateTime();