Weird date problem!

Discussion in 'ASP .Net' started by Mark, Jan 22, 2006.

  1. Mark

    Mark Guest

    Hi, I have a date / time in the following format

    1/25/2006 8:00:00 AM

    When I do the following on my local server Convert.ToDateTime('1/25/2006
    8:00:00 AM') I get 1/25/2006 8:00:00 AM which is fine..

    However, when I upload the code to my server in the states and do the same
    thing Convert.ToDateTime('1/25/2006 8:00:00 AM') I get
    1/25/2006 5:00:00 AM

    Does anyone have any idea *why* this is happening?? I am using ASP.NET 2.0

    Thanks
    Mark
     
    Mark, Jan 22, 2006
    #1
    1. Advertising

  2. Mark

    EJD Guest

    Mark,
    It looks that you're passing a string value to the Convert.DateTime,
    and that value should not differ even if the code was executed in a
    different time zone which it seems is the case with your situation.
    AFAIK. However, if the value passed to the Convert was coming from a
    call to DateTime.Now() then I guess you would see different values in
    different time zones unless the DateTimeKind has been specified (to
    local or UTC)... And servers by default use UTC to keep track of time
    but all of what I've said is irrelevant if you're just passing a string
    to the Convert...
    Hope this helps.
    Eric
     
    EJD, Jan 22, 2006
    #2
    1. Advertising

  3. Mark

    Mark Guest

    Hi Eric, thanks for your help.

    Yeah, I coud understand it if I was just going DateTime.Now() on a local
    server and then did the same thing on a remote server but this has me
    baffled...

    Thanks again
    Mark

    "EJD" <> wrote in message
    news:...
    > Mark,
    > It looks that you're passing a string value to the Convert.DateTime,
    > and that value should not differ even if the code was executed in a
    > different time zone which it seems is the case with your situation.
    > AFAIK. However, if the value passed to the Convert was coming from a
    > call to DateTime.Now() then I guess you would see different values in
    > different time zones unless the DateTimeKind has been specified (to
    > local or UTC)... And servers by default use UTC to keep track of time
    > but all of what I've said is irrelevant if you're just passing a string
    > to the Convert...
    > Hope this helps.
    > Eric
    >
     
    Mark, Jan 22, 2006
    #3
    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. Matt
    Replies:
    1
    Views:
    619
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,302
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    534
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    735
    Richard Heathfield
    Nov 8, 2003
  5. will
    Replies:
    6
    Views:
    426
    Phrogz
    Dec 27, 2006
Loading...

Share This Page