Reputation: 520
I am working on shopping cart, which stores DateTime in orders table when order is placed.
one of the row in order table shows date time 2015-07-24 02:34:45
When I display same on PHP page it displays 2015-07-24 01:43:33
It is happening with all entries in orders table. I am considering just one here, date displays correctly but time is not displaying properly
Default time zone is America/New_York
I am just selecting rows from order table and displaying on a PHP page.
Upvotes: 4
Views: 133
Reputation: 66
Setting GLOBAL value by command line will be reset if you restart your MySql. Instead set this in your my.cnf like
default-time-zone = "America/New_York"
Don't forget to restart your MySql after setting the option
Upvotes: 2
Reputation: 506
Mysql timezone != PHP timezone, you need set both separately. If your php.ini have America/New_York you need execute this mysql query:
SET GLOBAL time_zone = 'America/New_York';
Upvotes: 2