My datetime value is stored in the column as 12/03/2013 12:00 am, I am trying to parse out the date from a different column which is a string so i check to see if the datetime is a valid date. I can not figure out the format, yyyy-mm-dd hh:mm tt doesnt seem to make the condition true.
string[] format = new string[] { "yyyy-mm-dd hh:mm tt" };
DateTime datetime;
//12/03/2013 12:00 am
if (DateTime.TryParseExact(userFilters.FilterValue, format, CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault, out datetime))
{
DateEntered = datetime;
}
Pravesh Singh
12-Dec-2013You can try this :