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                                       [EMAIL PROTECTED]
-- 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to