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);