UTC DateTime从字符串值转换到多语言站点

时间:2014-03-13 09:47:41

标签: c# string datetime type-conversion sitefinity

1 个答案:

答案 0 :(得分:1)

我正在使用CultureInfo.InvariantCulture:

string str = Helper.Decrypt(dr.GetString(dr.GetOrdinal("LastLoginDate")));
DateTime result;
if (!DateTime.TryParse(str, out result))
   result = DateTime.Parse(str, CultureInfo.InvariantCulture, DateTimeStyles.None);