Weird date problem!

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
 
E

EJD

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
 
M

Mark

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top