I am trying to create a string to display the current date and time, not wanting to use any slashes just numbers.
For example, 09 jun 2011 11AMshould be201109061100
But when I run the code below, time is always 0000
Conclusion:
ResultLog201109060000
the code:
DateTime currDate = DateTime.Today;
String resultlogFilename;
resultlogFilename =
"ResultLog" +
currDate.ToString("yyyy") +
currDate.ToString("dd") +
currDate.ToString("MM") +
currDate.ToString("HH") +
currDate.ToString("mm");
Any idea how to choose the right time?
source
share