Date/Time Format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to figure out how to display "AM" or "PM" for the time? The book I am looking at shows "aa", but that does not work. This also means that I do not want to show time in a 24 hour format, but with a 12 hour format with am/pm indicator. How do you do this is in the .Net world

Thanks in advance for your assistance.
 
Hi Jim,

Take a look at DateTime.ToString() , you can format a DateTime as needed,
IIRC using this
DateTime.Now.ToString( "h:mm tt" , DateTimeFormatInfo.InvariantInfo )

Will do the trick. But I did not test it, I wrote it from memory so test it
before !!!

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

jim Heavey said:
I am trying to figure out how to display "AM" or "PM" for the time? The
book I am looking at shows "aa", but that does not work. This also means
that I do not want to show time in a 24 hour format, but with a 12 hour
format with am/pm indicator. How do you do this is in the .Net world?
 
Back
Top