Date/Time Format

Discussion in 'ASP .Net' started by =?Utf-8?B?amltIEhlYXZleQ==?=, Jun 2, 2004.

  1. 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.
     
    =?Utf-8?B?amltIEhlYXZleQ==?=, Jun 2, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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.
     
    Ignacio Machin \( .NET/ C# MVP \), Jun 2, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shaiboy_UK
    Replies:
    0
    Views:
    492
    Shaiboy_UK
    Oct 19, 2003
  2. Brian Candy
    Replies:
    2
    Views:
    1,179
    Janaka
    Feb 18, 2004
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,302
    Michael Borgwardt
    May 30, 2004
  4. Summu82
    Replies:
    5
    Views:
    877
    Richard Heathfield
    Jun 7, 2006
  5. dch3
    Replies:
    2
    Views:
    520
Loading...

Share This Page