Time zones are dumb (a PHP headache)

phatcactus

The Ugly Organist
So I just got this nice new server with a domain name and everything, which rules because I used to host my site off a PowerBook and it occasionally woke me up at night.

The trouble is that The new server is in Asia (I think maybe Hong Kong, but I'm no good at remembering things) and PHP's date() function returns the local time for the server, but that's really no good, because everyone who visits the site will be from around Chicago.

Is there some bit of code I can throw in my header file to make PHP use Chicago time instead of Asia time? Perhaps I could redefine some $_SERVER variable or something?

I'm really not a web developing kinda guy. It was all so easy when it was running from my bedroom! :(
 
This wasn't even in the right forum. I do apologize. Anyway, I've solved the problem! :)

Code:
putenv("TZ=US/Central");

Obviously, you can put whatever time zone you'd like in there.
 
Back
Top