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

Discussion in 'General Discussion' started by nick1, Apr 22, 2008.

  1. nick1

    nick1 Member

    Joined:
    May 21, 2006
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    My PHP script time is one hour far from my server time. Does anyone knows what could be the reason?

    The script I used to check time through PHP is:

    <?php
    echo date('l jS \of F Y h:i:s A');

    Thanks in advance
     
  2. mctDarren

    mctDarren Well-Known Member

    Joined:
    Jan 6, 2004
    Messages:
    664
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    New Jersey
    cPanel Access Level:
    Root Administrator
    Could be that your server did not update properly for daylight savings (if located and set for the US) You could try updating tzdata on your server to see if it corrects itself.
     
  3. Stefaans

    Stefaans Well-Known Member

    Joined:
    Mar 5, 2002
    Messages:
    451
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Vancouver, Canada
    If the time zone is critical to your script, then I suggest you set the desired time zone with the date_default_timezone_set(). That way your script will be independent of the time zone of the server. If the server time zone changes or you move the script to another server, your script will still yield consistent time values.
     
Loading...

Share This Page