-1

i have this string "1/20/2015 12:00:00 AM" and i need to convert in something like this "20/1/2015" without time and days first.

DateTime mydate = Convert.ToDateTime(myDateFromDB);

John Saunders
  • 160,644
  • 26
  • 247
  • 397

1 Answers1

0

To convert date string of format "dd/MM/yyyy" to DateTime, should used DateTime.TryParseExact where you can specify the date format string to let the converter know about the Culture.

To get the Date alone, use myDateTimeObj.Date.