例如:我们需要把形如在C#中默认显示的时间格式"2001-01-01"显示为:"20010101"形式,那么我们就可以这么做:
string strValues = System.DateTime.Now.ToString("yyyymmdd",System.Globalization.DateTimeFormatInfo.InvariantInfo);
int inttxt = System.Convert.ToInt32(strValues.toString());
lbDateTime.Text = Convert.ToDateTime(dr["MF_Date"]).ToString("yyyy/MM/dd");
lbDateTime.Text = string.Format("{0:yyyy/MM/dd}", dr["MF_Date"]);