string strDate = "21-03-2011";
DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
dtfi.ShortDatePattern = "dd-MM-yyyy";
dtfi.DateSeparator = "-";
DateTime objDate = Convert.ToDateTime(strDate, dtfi);
MessageBox.Show(objDate.ToShortDateString());
DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
dtfi.ShortDatePattern = "dd-MM-yyyy";
dtfi.DateSeparator = "-";
DateTime objDate = Convert.ToDateTime(strDate, dtfi);
MessageBox.Show(objDate.ToShortDateString());
No comments:
Post a Comment