Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Server/database time zone correct in admin wrong in database

    Upgrading is not always the best answer. This site just finished an upgrade that was started prior to 1.5.3 being released. When we picked it back up I looked at going with 1.5.4 but because some mods were not available and merging changes required was going to be a major undertaking we decided to complete the upgrade to 1.5.1 before we tackled 1.5.4.

    Perhaps I haven't made myself clear on what the problem is. I have installed the time zone fix mod (by Gilby) which is available for 1.5.1. Since installing the mod the correct time appears in admin/server info for both the database and server.
    Code:
    Server OS: Linux 2.6.32-458.23.2.lve1.2.45.el6.x86_64    	Database: MySQL 5.5.41-cll-lve
    Server Date: 02/02/2015 13:15:41   	Database Date: 02/02/2015 13:15:41
    The tz environment variable indicates that the timezone is set as expected
    Code:
    Environment Variable	Value
    TZ 	America/New_York
    The problem is that when looking at the date purchased timestamp on the admin/orders menu it is one hour behind. Looking at the database the times in the order records, customer info, others are all one hour behind even though the correct time is displayed in the admin. The emails sent also contain the wrong time.

    I'm trying to understand why even though the timezone seems to be set correctly the database is writing the incorrect time.

  2. #2
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Server/database time zone correct in admin wrong in database

    Quote Originally Posted by badarac View Post
    ... The problem is that when looking at the date purchased timestamp on the admin/orders menu it is one hour behind. ...
    So when you access "/admin/orders.php" the date listed for the orders is NOT correct?

    Quote Originally Posted by badarac View Post
    ... I'm trying to understand why even though the timezone seems to be set correctly the database is writing the incorrect time. ...
    The database server internally stores dates using the timezone configured for the MySQL server. MySQL server supports specifying the local timezone on a per-connection basis. MySQL functions such as "now()" will use the per-connection timezone if set, otherwise they will use the server's configured timezone.

    You need the files posted by Ajeh. These files add the "TZ" environment variable (not just the variable), adjust the PHP timezone, and query_factory will then pick up and use the timezone for the database connection. The files from Ajeh should be used instead of the "time zone fix mod (by Gilby)". The files do require PHP 5.3 (or newer).

    I still have one client on Zen Cart 1.5.1 with PHP 5.3 configured for 'America/Chicago' (client's timezone) and the MySQL server configured for 'America/New_York' (hosting provider's timezone)... Only timezone related modifications are the files posted by Ajeh... And the client sees the correct time in "/admin" and "/admin/orders.php"...

    As the account is on shared hosting, "phpMyAdmin" and the MySQL server's timezone are not changeable. So in cPanel accessing "phpMyAdmin" shows all the dates off by an hour. This is normal and expected. Just note the earlier caveat on how to export using "phpMyAdmin" to retain the correct date and time.


    NOTE 1: I was wrong earlier. While query_factory contains the necessary changes in Zen Cart 1.5.0+... I just downloaded a clean copy of Zen Cart 1.5.0 and 1.5.1 and files posted by Ajeh relating to this fix were not added prior to Zen Cart 1.5.2. My local copy had the files posted by Ajeh already applied (among other things)

    NOTE 2: And yes, the site mentioned above is slated for an upgrade in the very near future.
    Last edited by lhungil; 2 Feb 2015 at 09:37 PM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  3. #3
    Join Date
    Aug 2009
    Location
    Longs, SC
    Posts
    626
    Plugin Contributions
    2

    Default Re: Server/database time zone correct in admin wrong in database

    Thanks for that. I used Ajeh's code and it works correctly now. Just one note. The folder is incorrect for the first code block. It should be /includes/extra_configures/set_time_zone.php not /includes/extra_datafiles/set_time_zone.php.

  4. #4
    Join Date
    Jun 2005
    Posts
    20
    Plugin Contributions
    0

    Default Re: Server/database time zone correct in admin wrong in database

    I wish there was a setting in My Store Configuration for time zone adjustment. Then it would be easier to remember to modify it.

 

 

Similar Threads

  1. Correct time in ADMIN area, WRONG time on ORDER CONFIRMATION
    By Yoshi-M in forum General Questions
    Replies: 1
    Last Post: 16 Apr 2013, 07:44 PM
  2. Replies: 18
    Last Post: 8 Feb 2010, 08:23 PM
  3. Replies: 2
    Last Post: 10 May 2009, 09:56 PM
  4. moving server minimal down time w/ consistent database
    By sanguisdesign in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 21 Mar 2007, 12:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg