Format datetime...

Discussion in 'ASP .Net' started by Doug Swanson, Oct 17, 2003.

  1. Doug Swanson

    Doug Swanson Guest

    I'm trying to get a datetime value (10/24/2001 6:00 AM) to display as
    10/24/01 6:00. I know I could hard code some format but I'm trying to use
    the culture info etc. so that (and this is my understanding of it) if in the
    web.config I change the culture info to some country that disaplays as
    dd/mm/yy hh:mm then my app will display this in that manner.
    I can't seem to find any examples using the culture info...on a side note if
    I have a varable (mydate as DateTime) and it has a valid datetime value and
    I use one of it's functions...aka mydate.getshortdate() or
    mydate.getlongdate() will this return the value according to what my culture
    info is set to.

    thanks
    Doug

    --
    Doug Swanson
    Senior Applications Developer
    Synchrono, Inc
    651.228.1772
     
    Doug Swanson, Oct 17, 2003
    #1
    1. Advertising

  2. I had to display all my dates in Australian format.
    The solution turned out to be really easy.
    I just added a culture attribute to the end of my globalization tag in my
    web.config:

    <globalization requestEncoding="utf-8" responseEncoding="utf-8"
    culture="en-AU"/>

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com



    "Doug Swanson" <> wrote in message
    news:...
    > I'm trying to get a datetime value (10/24/2001 6:00 AM) to display as
    > 10/24/01 6:00. I know I could hard code some format but I'm trying to use
    > the culture info etc. so that (and this is my understanding of it) if in

    the
    > web.config I change the culture info to some country that disaplays as
    > dd/mm/yy hh:mm then my app will display this in that manner.
    > I can't seem to find any examples using the culture info...on a side note

    if
    > I have a varable (mydate as DateTime) and it has a valid datetime value

    and
    > I use one of it's functions...aka mydate.getshortdate() or
    > mydate.getlongdate() will this return the value according to what my

    culture
    > info is set to.
    >
    > thanks
    > Doug
    >
    > --
    > Doug Swanson
    > Senior Applications Developer
    > Synchrono, Inc
    > 651.228.1772
    >
    >
    >
     
    Steve C. Orr [MVP, MCSD], Oct 17, 2003
    #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. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    767
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    605
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    446
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    379
    Martin
    Dec 27, 2008
  5. Replies:
    2
    Views:
    806
    M.-A. Lemburg
    Jan 6, 2009
Loading...

Share This Page