PDA

View Full Version : Time Offset


Boofo
08-10-2002, 11:00 AM
Can anyone please tell me how to set the timezoneoffset for the following lines of code? I have tried to figure it out with no success. :(

$time_lastup = strtotime($weatherdata[lastup]);
$weather[updatedate] = vbdate($dateformat,$time_lastup);
$weather[updatetime] = vbdate($timeformat,$time_lastup);

Xenon
08-10-2002, 12:29 PM
$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600

Boofo
08-10-2002, 12:40 PM
Thank you, sir. ;)

So it should look like this when I am done, right?

$time_lastup = strtotime($weatherdata[lastup]);
$weather[updatedate] = vbdate($dateformat,$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600);
$weather[updatetime] = vbdate($timeformat,$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600);


Originally posted by Xenon
$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600

Xenon
08-10-2002, 12:52 PM
no, put the code i gave you in a new line after the first line

Boofo
08-10-2002, 01:03 PM
Like this?

$time_lastup = strtotime($weatherdata[lastup]);
$time_lastup+=($bbuserinfo['timezoneoffset']-$timeoffset)*3600
$weather[updatedate] = vbdate($dateformat,$time_lastup);
$weather[updatetime] = vbdate($timeformat,$time_lastup);

Does there have to be a semi-colon at the end of the new line?

Xenon
08-12-2002, 12:47 AM
of course there have to be a ; ;)

and yes this should be correct now

Erwin
08-12-2002, 10:07 PM
That's for JR's weather hack. :) Does it work Boofo?

Boofo
08-13-2002, 07:11 PM
For some reason, it isn't working quite right. It changes the time OK, but now instead of being at the server time, it is 6 hours behind the server now. The server is set at GMT and my timeoffset is at -6. The weather time is showing up 12 hours behind me now instead of 6 hours behind like before. Any ideas on this one, buddy? :)

Xenon
08-13-2002, 10:44 PM
hmm, try to replace all + with an - and all - with an +

Boofo
08-13-2002, 11:14 PM
Here's the code with the changes you suggested.

$time_lastup = strtotime($weatherdata[lastup]);
$time_lastup-=($bbuserinfo['timezoneoffset']+$timeoffset)*3600;
$weather[updatedate] = vbdate($dateformat,$time_lastup);
$weather[updatetime] = vbdate($timeformat,$time_lastup);

It almost works. The time is showing (when logged in) at 1/2 hour ahead of my time. At 7:10 pm it shows 7:40 pm. But when logged out it shows 11 1/2 hours behind. It shows yesterday at 7:40 pm when it is today at 7:10 pm.

Originally posted by Xenon
hmm, try to replace all + with an - and all - with an +