C#字符串转化为时间
**第一种方法**
string timeStr = "2019-08-28";
DateTime yesTime = Convert.ToDateTime(timeStr);
**第二种:**
DateTimeFormatInfo timeForInfo = new DateTimeFormatInfo();
timeForInfo.ShortDatePattern = "yyyy/MM/dd";
string timeStr1 = "2018-09-08";
var time = Convert.ToDateTime(timeStr1, timeForInfo);
**第三种:**
string dateString = "20190526";
DateTime dt = DateTime.ParseExact(dateString, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);