Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP date(); problems

Options
  • 13-04-2007 3:43pm
    #1
    Registered Users Posts: 1,987 ✭✭✭


    Im using the date() function on my site and the time is showing up an hour behind, its also showing up an hour behind on my chat forum, i've emailed tech support which confirmed that the time is set right on the hosting server! Anyone know why the time would change like this, it had been working fine before!???


Comments

  • Closed Accounts Posts: 68 ✭✭nuada


    I would think that this is related to daylight saving time.


  • Closed Accounts Posts: 593 ✭✭✭McSandwich


    Ziycon wrote:
    Im using the date() function on my site and the time is showing up an hour behind, its also showing up an hour behind on my chat forum, i've emailed tech support which confirmed that the time is set right on the hosting server! Anyone know why the time would change like this, it had been working fine before!???

    I've had this problem and fixed it by using gmdate() as a dirrect replacement for date()

    http://ie.php.net/gmdate


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    On my localhost server the date(); works fine! When i change to gmdate(); my localhost server shows the time an hour behind!

    If date(); works on my localhost server then it should work on the live host server!


  • Registered Users Posts: 3,514 ✭✭✭Rollo Tamasi


    Ziycon wrote:
    On my localhost server the date(); works fine! When i change to gmdate(); my localhost server shows the time an hour behind!

    If date(); works on my localhost server then it should work on the live host server!

    Surely the date is read by the server's clock? So if your server is in space then the time will be presented as per the time in space.


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    And its an Irish based server too so it should have the right time! Its so fustrating!


  • Advertisement
  • Closed Accounts Posts: 97 ✭✭VroomVroom


    I'm not sure what causes it and I don't have a solution to it, but on some PHP sites (Example...boards.ie) the time displays wrongly... I haven't found out where the time is coming from (web server, db server, local pc clock...)

    Right now, when I go to boards.ie home page, all of the recent posts are time stamped as 15:48...15:49, etc.

    When I select a thread, the same thread is timestamped as 16:48 (i.e. The correct time). PC clock says it is 16:48.


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    VroomVroom wrote:
    I'm not sure what causes it and I don't have a solution to it, but on some PHP sites (Example...boards.ie) the time displays wrongly... I haven't found out where the time is coming from (web server, db server, local pc clock...)

    Right now, when I go to boards.ie home page, all of the recent posts are time stamped as 15:48...15:49, etc.

    When I select a thread, the same thread is timestamped as 16:48 (i.e. The correct time). PC clock says it is 16:48.
    Thats strange! Looks like im not the only person with the problem then!:D


  • Closed Accounts Posts: 97 ✭✭VroomVroom


    php.jpg

    Here is what I am getting, 2 times, same web page...

    If you refresh the boards.ie homepage a few times, the times on the post will occasionally change to the correct times.

    I'm guessing that boards uses a few webservers, some have the correct time, some don't. Unlikely to be a problem with your php code...


  • Closed Accounts Posts: 593 ✭✭✭McSandwich


    Try:

    date_default_timezone_set("Europe/Dublin");
    date();
    gmdate();


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    McSandwich wrote:
    Try:

    date_default_timezone_set("Europe/Dublin");
    date();
    gmdate();

    Thanks man, that worked perfect!


  • Advertisement
Advertisement