0
我的问题是我无法将美国日期值转换为英国格式。 TryParse条件总是作为false出现,因此outputValue永远不会被填充。将美国日期时间转换为文化特定值
执行有问题吗?请指出或建议更好的选择。谢谢。
string filterValue = "12/22/2011"
string outputValue = ""
DateTime dt;
string strCulture = "en-GB";
CultureInfo ci = new CultureInfo(strCulture);
if (DateTime.TryParse(filterValue, ci, DateTimeStyles.AdjustToUniversal, out dt))
outputValue = dt.ToString("d", ci);