Re: printing time in log messages

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Oct 14, 2:03 pm, puzzlecracker <ironsel2...@xxxxxxxxx> wrote:
On Oct 14, 1:56 pm, za...@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.

Argh, I don't think sting has Format member function :(

Yes, it does. I use it all the time.
.