Culter + Date Format in MM/DD/YYYY Database - how to force a single format?

Discussion in 'ASP .Net' started by Chu, Aug 14, 2006.

  1. Chu

    Chu Guest

    In playing with asp.net 2.0, I've been impressed with the
    internationalization support that's built right in. It's great that I
    can simply add a tag to my page's directive and it magically transforms
    all dates into my end user's date format. However, it's causing a
    problem that I've yet to find a cure for:

    My server is located in the US, where we obviously use the date format
    MM/DD/YYYY. I use DateTime.Now through my code which works great until
    the client's system is setup to use another format, such as DD/MM/YYYY
    -- then the database gets fed the wrong date format. Is there a way I
    can tell, or format DateTime.Now back into a specific format for my
    database?
    Chu, Aug 14, 2006
    #1
    1. Advertising

  2. Chu

    Shawn Guest

    myDate.Tostring("MM/dd/yyyy")

    Shawn

    "Chu" <> wrote in message
    news:...
    In playing with asp.net 2.0, I've been impressed with the
    internationalization support that's built right in. It's great that I
    can simply add a tag to my page's directive and it magically transforms
    all dates into my end user's date format. However, it's causing a
    problem that I've yet to find a cure for:

    My server is located in the US, where we obviously use the date format
    MM/DD/YYYY. I use DateTime.Now through my code which works great until
    the client's system is setup to use another format, such as DD/MM/YYYY
    -- then the database gets fed the wrong date format. Is there a way I
    can tell, or format DateTime.Now back into a specific format for my
    database?
    Shawn, Aug 14, 2006
    #2
    1. Advertising

  3. Chu

    Chu Guest

    Isn't there an easier way to do it? I'd have to go back to many places
    in the code just to make that change.

    I guess this brings up the point of best practices when using dates in
    code. Generally speaking, how is it normally handled? Is there someone
    to just get the server's "Now" time in the server's culture?


    Shawn wrote:
    > myDate.Tostring("MM/dd/yyyy")
    >
    > Shawn
    >
    > "Chu" <> wrote in message
    > news:...
    > In playing with asp.net 2.0, I've been impressed with the
    > internationalization support that's built right in. It's great that I
    > can simply add a tag to my page's directive and it magically transforms
    > all dates into my end user's date format. However, it's causing a
    > problem that I've yet to find a cure for:
    >
    > My server is located in the US, where we obviously use the date format
    > MM/DD/YYYY. I use DateTime.Now through my code which works great until
    > the client's system is setup to use another format, such as DD/MM/YYYY
    > -- then the database gets fed the wrong date format. Is there a way I
    > can tell, or format DateTime.Now back into a specific format for my
    > database?
    Chu, Aug 14, 2006
    #3
  4. Chu

    Shawn Guest

    Maybe Session.LCID is what you need.
    http://www.google.com/search?source...&rls=GGLD,GGLD:2005-14,GGLD:en&q=session.LCID

    Shawn

    "Chu" <> wrote in message
    news:...
    Isn't there an easier way to do it? I'd have to go back to many places
    in the code just to make that change.

    I guess this brings up the point of best practices when using dates in
    code. Generally speaking, how is it normally handled? Is there someone
    to just get the server's "Now" time in the server's culture?


    Shawn wrote:
    > myDate.Tostring("MM/dd/yyyy")
    >
    > Shawn
    >
    > "Chu" <> wrote in message
    > news:...
    > In playing with asp.net 2.0, I've been impressed with the
    > internationalization support that's built right in. It's great that I
    > can simply add a tag to my page's directive and it magically transforms
    > all dates into my end user's date format. However, it's causing a
    > problem that I've yet to find a cure for:
    >
    > My server is located in the US, where we obviously use the date format
    > MM/DD/YYYY. I use DateTime.Now through my code which works great until
    > the client's system is setup to use another format, such as DD/MM/YYYY
    > -- then the database gets fed the wrong date format. Is there a way I
    > can tell, or format DateTime.Now back into a specific format for my
    > database?
    Shawn, Aug 15, 2006
    #4
    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. =?Utf-8?B?Q3liZXJMb3R1cw==?=

    Does CompareValidator work for the date in dd-mmm-yyyy format?

    =?Utf-8?B?Q3liZXJMb3R1cw==?=, Jun 10, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    15,767
    Peter Blum
    Jun 10, 2005
  2. Abhijit
    Replies:
    8
    Views:
    15,640
    Matt Hurd
    Sep 16, 2004
  3. Ashraf Ansari

    convert MM/dd/yyyy format into dd/MM/yyyy

    Ashraf Ansari, Aug 30, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    777
    Alexey Smirnov
    Aug 30, 2007
  4. Gilles Ganault

    Converting DD MM YYYY into YYYY-MM-DD?

    Gilles Ganault, Aug 17, 2009, in forum: Python
    Replies:
    18
    Views:
    1,331
    Mark Tolonen
    Aug 20, 2009
  5. J P Singh
    Replies:
    4
    Views:
    272
    J P Singh
    Feb 10, 2004
Loading...

Share This Page