-
Timezones
Greetings, Does anybody know about setting up support for timezones on a website?
I've got all the code in place to support timezones on my site. It apears that everything is working ok except for the fact that all the times are one hour off. I can't for the life of me figure out what's causing this, it almost seems like daylight savings is being added twice.
Can somebody help me with this? I'll post code as needed. I have a feeling it's probably a simple solution, I just cannot find it.
Thanks in advance.
-
-
Ok, there's quite a bit of code for this, but I'll post the main peices:
Code:
'Set the default date/time for the entire site,
'this variable will be inserted into the db for new forum posts etc
strForumTimeAdjust = DateAdd("n", - intForumBias - intForumDaylAdjust, DateAdd("n", + intServerBias , Now()))
'converts the date/time to the users local time
'fdate is coming from the database
fDate = DateToStr(DateAdd("n", intForumBias -intLocalBias - DayLightSave + intForumDaylAdjust, strToDate(fDate)))
Here is what all the variables look like:
intForumBias=300
intForumDaylAdjust=-60
intServerBias=300
now=6/17/2003 8:24:37 AM
strForumTimeAdjust=6/17/2003 9:24:37 AM
DaylightSave=-60
intLocalBias=300
The rest of the code calculates the variable values.
My code is based on the Snitz Forums code, if anybody's familier with that.
-
I just wanted to convert those two lines of code into English to see if they make sense.
Code:
strForumTimeAdjust = DateAdd("n", - intForumBias - intForumDaylAdjust, DateAdd("n", + intServerBias , Now()))
You are adjusting the current time at the server. If the server is setting on the US east coast (where I am now, and where I'm guessing things are with your 300 minute bias), then if it is currently 10 am according to the clock onthe wall, this formula will give us:
(10:00 + 300min) - 300min - (-60min)
10:00 + 5hours - 5hours + 1 hour
10:00 + 1hour
11:00
Well, since the time gathered from Now() was already adjusted for DST, we didn't need to add the extra hour. Since we are under DST, our bias should only be four hours, not five.
Am I misunderstanding this code?
-
No, your not misunderstanding. But I shouldn't set the bias to -4 when in fact it's -5, right?
If I took out the '- intForumDaylAdjust' it works. Untill DST is over or if your in a timezone that is not observing DST.