|
-
Jun 17th, 2003, 07:41 AM
#1
Thread Starter
New Member
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.
The Internet ClubHouse
Come Join the fun!
---------------------------------------------------------------------------------------
Nobody Listens, so I talk to myself. Sometimes I pay me no mind.
---------------------------------------------------------------------------------------
-
Jun 17th, 2003, 07:46 AM
#2
Fanatic Member
-
Jun 17th, 2003, 07:51 AM
#3
Thread Starter
New Member
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.
Last edited by Anacrusis; Jun 17th, 2003 at 07:55 AM.
The Internet ClubHouse
Come Join the fun!
---------------------------------------------------------------------------------------
Nobody Listens, so I talk to myself. Sometimes I pay me no mind.
---------------------------------------------------------------------------------------
-
Jun 17th, 2003, 08:59 AM
#4
Addicted Member
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?
Travis, Kung Foo Journeyman
Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
OSS: Mozilla, MySQL (Manual)
-
Jun 17th, 2003, 09:23 AM
#5
Thread Starter
New Member
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.
The Internet ClubHouse
Come Join the fun!
---------------------------------------------------------------------------------------
Nobody Listens, so I talk to myself. Sometimes I pay me no mind.
---------------------------------------------------------------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|