Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
DateTime fromDate; DateTime.TryParseExact(FromDateTextBox.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out fromDate);
检查 TryParseExact 的返回值
bool res = DateTime.TryParseExact(FromDateTextBox.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out fromDate); if (res == false) { //date is not parsable... }