日期格式转换, Excel中第一列,例如2011-01-01转换为2011 1 1 string[] s3 = newdata[k].Split('/t'); //newdata中每行按'/t'拆分 方法一: string[] s4= s3[0].Split('-'); if (s4[1].StartsWith("0")) { s4[1]=s4[1].Replace("0",""); } if (s4[2].StartsWith("0")) { s4[2] = s4[2].Replace("0", ""); } s2 +="/t" +s4[0] + "/t" + s4[1] + "/t" + s4[2] + "/t" + s3[i + 1]; 方法二: System.DateTime myDateTime =System.DateTime.Parse(s3[0]);//myDataTime={2011-1-1 0:00:00} string year = myDateTime.Year.ToString(); string month = myDateTime.Month.ToString(); string day = myDateTime.Day.ToString();