當我試圖解析日期是這樣的:解析字符串至今的奇怪錯誤?
DateTime t1 = DateTime.ParseExact("August 11, 2013, 11:00:00 PM", "MMMM dd, yyyy, hh:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture);
它正常工作,但是當我做這樣的事:
string s ="August 11, 2013, 11:00:00 PM";
DateTime t = DateTime.ParseExact(s, "MMMM dd, yyyy, hh:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture);
我得到這個錯誤:
的例外類型'System.FormatException'發生在 mscorlib.ni.dll中,但未在用戶代碼中處理
因此,我如何刪除它,因爲我已經從模型中刺痛它? –
@AhmedEmad'var newstr = new string(s1.Where(c => c <128)。ToArray())' – I4V
Thanx現在很努力地工作 –