private void Form1_Load(object sender, System.EventArgs e){
DateTime dt;
string InputDateString = "20070328";
int iYear =
System.Convert.ToInt32(InputDateString.Substring(0,4));
int iMonth =
System.Convert.ToInt32(InputDateString.Substring(4,2));
int iDay =
System.Convert.ToInt32(InputDateString.Substring(6,2));
dt = new DateTime(iYear, iMonth, iDay);
MessageBox.Show(dt.Date.ToString());
MessageBox.Show(dt.Year+" "+dt.Month+", "+dt.Day);
//Change Any Format As You Like It
}
No comments:
Post a Comment