Author: Purva Verma | Posted on: 2/19/2009 8:44:24 AM | Views : 330

Hi I need to display the Date Time in the format "ddmmyy_hhmiss"

Hours should be displayed as 0-24 hrs.
For this I am using
Date.Now.ToString("ddMMyy") + "_" + DateTime.Now.TimeOfDay.Hours.ToString() + DateTime.Now.TimeOfDay.Minutes.ToString() + DateTime.Now.TimeOfDay.Seconds.ToString()

But the problem with this is , if the Current Time is something like 9 hrs 5 min 7 secs (AM) 

this is displayed as 957. This should be displayed as 090507.

Please tell me how should I format this to get it in the required format.

 

 

 
...

Go to the complete details ...