Trouble getting the date time format I need

  • Thread starter Thread starter MJ
  • Start date Start date
M

MJ

I need to get some data into "perfmon" format. I'm using DateTime.Now().

How do I convert

"3/16/2006 10:43:29 PM"

to

"03/16/2006 22:43:239.123"

Thanks in advance!

-mj
 
Hi MJ,

You could try this.

Convert.ToString(String.Format("{0:MM/dd/yyyy}",System.DateTime.Now()));

Regards,

Ton
 
Guess DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff") is what you want.
 
Sorry, should be DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.fff").
 
Thanks guys. That worked! I usually go to MSDN to figure this kind of stuff
out, but I didn't have the time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top