Re: printing time in log messages

Tech-Archive recommends: Speed Up your PC by fixing your registry



The page peter posted is the best reference. Personally I prefer

System.DateTime.Now.ToString("HH:mm:ss");

our systems are in UTC

System.DateTime.UTCNow.ToString("HH:mm:ss");


"zacks@xxxxxxxxxxxxxxxxxxxxxxxx" wrote:

On Oct 14, 1:51 pm, puzzlecracker <ironsel2...@xxxxxxxxx> wrote:
I have this string string time =
System.DateTime.Now.ToLongTimeString(); it is equal to 1:00:22 PM

I need it to be 13:00:22

Any suggestions how to format it?

Thanks

string.Format("{0:HH}:{1:mm}:{2:ss}", Now, Now, Now)

This is just one of many ways it can be done.

.