日期时间格式全球化变化

Datetime format globalization change

我想将不同的日期格式转换为当前日期格式

示例:

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("tr-TR");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("tr-TR");
string dateString = "16.03.2020 10:50:00"; //(I record the value) (now format dd.MM.yyyy HH:mm:ss)

//Change Culture (en-US)
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

Datetime convertedDate = Convert.ToDatetime(dateString); //(now format dd/MM/yyyy HH:mm:ss)

error = String was not recognized as a valid DateTime

我该如何解决?

我是这样解决的

string dateString = "16.03.2020 10:55:10"; //Çağdaş SANCARBARLAZ
DateTime lastCheckDate = Convert.ToDateTime(dateString,
System.Globalization.CultureInfo.GetCultureInfo("tr-TR").DateTimeFormat);

结果:

谢谢大家