什麼是錯的這個片段,導致錯誤:什麼是我的代碼導致此錯誤:字符串未被識別爲有效的DateTime
DateTime today = DateTime.Today;
DateTime bday = DateTime.Parse(ctxtBirthday.Text);
int age = today.Year - bday.Year;
ctxtAge.Text = age.ToString();
ctxtBirthday.Text
例如包括:日期:1978-03-08
ctxtAge.Text
是我想要的年齡結果。
當.aspx
負荷是錯誤:
System.FormatException
String was not recognized as a valid DateTime.
可能幫助,如果你告訴我們到底是什麼錯誤是。 – PaulF