PDA

View Full Version : Time Zone


odelljl
04-10-2003, 07:42 AM
It appears that the servers at DiscountASP.Net are set to the Pacific Time Zone - at east my customers, expecting EST, are reporting their timestamps are "3 hours off".

I'm confirming this with support now. In the mean time, how are people handling these issues in their ASP.NET applications? I've found methods to convert to Universal Time and back and can start coding, but I'm wondering what folks do.

TIA -

jlo

bruce
04-10-2003, 11:32 AM
Yes. Our servers are set to PST timezone.

There was a big thread about this same topic on the ASPNet mailing list. Below is couple messages that might be of relevence.

Hope this helps.



Hi Doug,

I grab the UTCOffset using Javascript and use a hidden field to post the UTCOffset to the server when the user logs on. That way you get the user's UTCOffset rather than the server's. You can store this variable as a session variable or a cookie or something else and use it on the server side to modify the time date display sent back to the user.

Cheers

Mark

Mark Smithers
Director
Myoporum P/L
www.myoporum.com
Victoria
Australia


-----Original Message-----
From: Doug Wilson [mailto:doug@ix.co.za]
Sent: Monday, April 07, 2003 11:06 PM
To: aspnet@aspadvice.com
Subject: [aspnet] RE: Server Time Zone


Hi Mark

Thanks for the response. I am building this for 3 existing applications that I've inherited and have been running for over a year now, all recording local time in the db.

It looks like I'm going to have to first convert the current db time to UTC - then grab users UTCOffset and then display calculated converted time. Been doing a little research, and my next question is how would I grab the users UTCOffset? Won't GetUtcOffset return the server's offset?





Doug Wilson
Web Developer
www.ix.co.za - www.autoworld.co.za
304 Gateview, Sugerclose Drive, Gateway, Umhlanga
Tel : +2731 5669250 - Fax : +2731 5669260
Cell : 084 8000 255 - ICQ : 173155300


-----Original Message-----
From: Mark Smithers [mailto:mark@myoporum.com]
Sent: 07 April 2003 01:54
To: aspnet@aspadvice.com
Subject: [aspnet] RE: Server Time Zone

Hi Doug,

I set all my dates and times to UTC in the db and the app as I am designing apps for a global market. That way it doesn't matter where the server is.

I then grab the UTCOffset from the user's browser and use it to modify the display of dates and times to the client. It might be a solution for you.

Cheers

Mark

Mark Smithers
Director
Myoporum P/L
www.myoporum.com
Victoria
Australia



[b]quote:Originally posted by odelljl

It appears that the servers at DiscountASP.Net are set to the Pacific Time Zone - at east my customers, expecting EST, are reporting their timestamps are "3 hours off".

I'm confirming this with support now. In the mean time, how are people handling these issues in their ASP.NET applications? I've found methods to convert to Universal Time and back and can start coding, but I'm wondering what folks do.

TIA -

jlo
</blockquote id="quote"></font id="quote">

dazinith
04-15-2003, 09:41 AM
i came across this message and was really confused still.. but after 10 minutes of looking i found the way that i will handle getting the real current time for all users..

DateTime realTime = DateTime.UtcNow + System.TimeZone.CurrentTimeZone.GetUtcOffset(DateT ime.Now);
TestSpot.Text = realTime.ToString();

hope this helps anyone who searches for it like me :)

dazinith
04-15-2003, 09:55 AM
arg.. looks like i spoke too soon.. the 'System.TimeZone.CurrentTimeZone' returns the servers timezone.. not the users.. arg..

for now i am offseting a hard coded 3 hour timespan for east coast, and i guess this will eventually be a user option.. can someone explain to me the correct way to get the user's timezone to offset with?

thanks!

bruce
04-16-2003, 09:12 AM
As suggested in the earlier post, client timezone must be retrived from the client side (using Javascript or vbscript).

I did some searching on the net and found this article that may help you

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6314

Good luck :>

[b]quote:Originally posted by dazinith

arg.. looks like i spoke too soon.. the 'System.TimeZone.CurrentTimeZone' returns the servers timezone.. not the users.. arg..

for now i am offseting a hard coded 3 hour timespan for east coast, and i guess this will eventually be a user option.. can someone explain to me the correct way to get the user's timezone to offset with?

thanks!
</blockquote id="quote"></font id="quote">