Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

want to set the timezone in mysql also

<?php
   echo date_default_timezone_get();
   $currenttime = date('h:i:s:u');
   list($hrs,$mins,$secs,$msecs) = split(':',$currenttime);
   echo " => $hrs:$mins:$secs\n";

   date_default_timezone_set('US/Eastern');
   echo date_default_timezone_get();
   $currenttime = date('h:i:s:u');
   list($hrs,$mins,$secs,$msecs) = split(':',$currenttime);
   echo " => $hrs:$mins:$secs\n";

   date_default_timezone_set('America/New_York');
   echo date_default_timezone_get();
   $currenttime = date('h:i:s:u');
   list($hrs,$mins,$secs,$msecs) = split(':',$currenttime);
   echo " => $hrs:$mins:$secs\n";

?>

Open in new window


but this mysql query keeps the timezone of the server
mysql_query("update table set sent=NOW() ");
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

i think these are similar links to mysql.com

I am using godaddy shared server

and mysql thinks it is mountain time zone

do I have to contact godaddy
because I do not have command line access to
mysql> SET GLOBAL time_zone = timezone;



>>However, if you are on a shared server, you must set the time zone for your connection every time you connect on a new PHP page.

is this done in php/mysql connection string
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

>>
See the part about "Storing Date" in this article.
http://dev.mysql.com/doc/refman/5.5/en/datetime.html

I can not find 'insert a date 1 hour more'


>>
Use a query that says something like SET time_zone = '+00:00' to adjust the value in MySQL



I found this in your article but this query does not change the result in shared server, I have not tried localhost yet
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

thanks

best answer is
this wont work BECAUSE i am using a shared server