string str3;try {
System.DateTime.Parse(str3.Substring(0,4)+"-"+str3.Substring(4,2)+"-"+str3.Substring(6,2));
}
catch (Exception)
{
MessageBox.Show("日期输入格式不正确!","出错了");
return;
我们的测试日期数据都是八位的字符 如:20070605,20071106