DateTime format string

DateTime date = DateTime.Parse("2011-05-04 14:33:41"); //4 may 2011

How do I convert this date to "20110504 14:33:41"?

+5
source share
1 answer

Format it like this:

string formattedDate = date.ToString("yyyyMMdd HH:mm:ss");
+14
source

All Articles