//将含有正确日期格式的string类型转换成DateTime类型
string strDate = "2014-08-01";
DateTime dt1 = Convert.ToDateTime(strDate);
//将包含时分秒的string类型日期转换成DateTime类型
string strDateTime = "2014-08-01 10:57:31";
DateTime dt2 = Convert.ToDateTime(strDateTime);
原文:https://www.cnblogs.com/LCLBook/p/13606664.html