Time Zone

How do i adjust the server time for my web site? I used a simple php script to get the time but it is’nt in my time zone. I try adjusting it thorugh the php script but certain times i get really wierd results…
my time zone is Standard Time +0800 UTC.
pls help

Basically you want to take the epoch time and subtract the number of seconds then format the result to a date string.

:cool: Perl / MySQL / HTML+CSS

The putenv() function might help. You can read up on it here: http://www.php.net/putenv

I’m in US central, so I would put this:


You would just need to adjust it to your time zone. There’s probably a list somewhere on the PHP or Apache web sites.

I’m having the same problem…
I’m running textclock.pl (http://www.scriptarchive.com/readme/textclock.html ) and the time being returned is 3 hours off.

I barely understand .cgis, so while the putenv command looks like it might solve my problem I don’t understand how to use it.

Could someone spell it out for a newbie like me? :wink:
Thank you ever so much!!


What I do is put this line in my .htaccess file: (it should be in your web site’s root directory, or you may have to create it)

SetEnv TZ America/Montreal

That way it applies site-wide, and you don’t have to change individual scripts.

Note that if you are using MySQL, it will always be in the Pacific time zone, and there’s nothing you can do about it (until they upgrade to MySQL 4.1, which supports time zones.) You’ll have to manually add/subtract the appropriate number of hours whenever you use time functions such as NOW().

You can use the “tzselect” command to figure out what the correct time zone for you is.