The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Time Stamp Incorrect

Discussion in 'General Discussion' started by keat63, Apr 13, 2015.

  1. keat63

    keat63 Well-Known Member

    Joined:
    Nov 20, 2014
    Messages:
    765
    Likes Received:
    20
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    It seems that since DST, the time stamps are out by an hour on 2 of my commerce web sites.
    These are running PHP, so I assume it has something to do with date.timezone being set for UTC ?

    The server time is correct, and I can offset the time stamp by an hour using the web site application, however, the web site generates customer order numbers based on the time, so even though the web site displays the correct time, the order numbers are still out by an hour.

    Is there a setting other than UTC, where PHP will take it's time from the server, and preferably, something permanent, so that I don't have this issue again when the clocks change later in the year.
     
  2. El Morgan

    El Morgan Registered

    Joined:
    Apr 13, 2015
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Fayetteville
    cPanel Access Level:
    Root Administrator
    Hi - have you tried adding this to your php.ini? You'd want to make sure you use the correct time zone for your location, of course!

    [Date]
    ; Defines the default timezone used by the date functions
    date.timezone = America/New_York
     
  3. keat63

    keat63 Well-Known Member

    Joined:
    Nov 20, 2014
    Messages:
    765
    Likes Received:
    20
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    After a little digging last night, i found that changing PHP config from UTC to Europe/London, fixed the time stamp issue.
    I'm not sure what will happen in October when the clocks go backwards though.
    I guess I'll address this later in the year.
     
  4. matthers

    matthers Member

    Joined:
    Jul 6, 2013
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    your server time is synced to a NTP time server and the hour will be automatically adjusted when the clocks go +/- 1 hour
     
  5. keat63

    keat63 Well-Known Member

    Joined:
    Nov 20, 2014
    Messages:
    765
    Likes Received:
    20
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    The clocks did adjust accordingly a few weeks ago, i assume that the issue was with PHP and UTC.
    It's this that i'm questioning
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,852
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page