Ian Ramsey-Planck wrote" "On 3/2/2008 9:04 PM":" > > > <moderators note> > We write our responses below the original email in this list group. > > From: php-list@yahoogroups.com <mailto:php-list%40yahoogroups.com> > [mailto:php-list@yahoogroups.com <mailto:php-list%40yahoogroups.com>] On > Behalf > Of James Keeline > Sent: March 2, 2008 8:56 PM > To: php-list@yahoogroups.com <mailto:php-list%40yahoogroups.com> > Subject: Re: [php-list] Date/Time Offset > > --- Ian <[EMAIL PROTECTED] <mailto:iarp%40cogeco.ca> > <mailto:iarp%40cogeco.ca> > wrote: > > > I've spent most of today reading up on PHP and on problem i have so > > far is my MySQL server's timezone is at 0000hours and i need it to > > save the info as -0500hours. I read on php.net using Z and then like > > -0500 but nothing works for me, every registration i do keeps saving > > in 0000hrs. Anyway to offset to DATETIME to the -0500hrs needed? > > > > $query = "INSERT INTO users (first_name, last_name, email, password, > > registration_date) VALUES ('$fn', '$ln', '$e', SHA('$p'), NOW())"; > > My experiences have suggested that the time stored for MySQL fields is based > on > the server time. What is your server's time zone setting? > > James > > -------------------- > > James, > > The servers current time is March 3rd 2008 3am putting that > somewhere in Europe I think, I was kind of hoping there was a way to put in > negative times with php. Like you see on forum boards you can choose what > timezone you want shown, that kind of things fine as well but it's the > formatting it to show my timezone that I don't know how to do. > > Thanks > > Ian R-P
If you cannot change the server time, try an insert like the following: $query = "INSERT INTO users (first_name, last_name, email, password, registration_date) VALUES ('$fn', '$ln', '$e', SHA('$p'), date('Y-m-d H:i:s',strtotime('-3 hours'))"; That will put in format "2008-03-03 07:41:13" and subtract 3 hours from the current server time.