RE: [PHP] local time v.s. server time

From: Date: Sat, 25 Aug 2001 03:39:15 +0000
Subject: RE: [PHP] local time v.s. server time
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-64393@lists.php.net to get a copy of this message
On 25-Aug-2001 Joe Sheble \(Wizaerd\) wrote: > My website is hosted with a provider, and there is a three hour difference > in timezones, so when saving date and times to the database, they reflect > the server time and not my own local time. The clincher is I know I could > do some time math and just substract 3 hours, but I live in Arizona, so we > do not go through daylight savings time. So right now it's a three hour > difference, but when the time change happens, I'll only be two hours behind. > > Because of this, what is the best method to get my local date and time > entered into the database instead of the server date and time?? > In my case the server is in Atlanta, but I have to sync with my credit-card processor on the left coast. So first i start the database (MySQL) on Pacific time with: ----- TZ=PST8PDT export TZ /usr/local/bin/safe_mysqld --user=mysql > /dev/null & ---- To make PHP date/time functions jive, during initialization: putenv('TZ=PST8PDT'); // Server on Pacific time No matter that i'm in Texas (CST), everything is now reported on Pac time. Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#64393) next »