Weird date problem!

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

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,
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
 
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
 
Back
Top