方法一:
string mytime = "20070520";
string newtime = mytime.Substring(0, 4) + "-" + mytime.Substring(4,2) + "-" + mytime.Substring(6,2);
Response.Write(newtime);
string newtime = mytime.Substring(0, 4) + "-" + mytime.Substring(4,2) + "-" + mytime.Substring(6,2);
Response.Write(newtime);
方法二:
string time = "20070520".Insert(4, "-").Insert(7, "-");
Response.Write(time);