I have a diary database which runs on two websites, hosted by different servers. Dates are stored in unix timestamp format

The dates displayed on one server are all 8 hours later than the other. I've tried copying pages fom one server to another, and the disparity is still the same.

The code is identical for both pages, apart from the images and colours

The two pages are here:

http://www.playwork.co.uk/diary.php

http://www.playwork.org.uk/diary.php4

any ideas?

TIA
Julia

    you servers time are different. Try formating the date first

      The UNIX time being stored in your DB comes from the server hosting your database.

      So, for the site that is in a different time zone, you need to adjust for the 8 hours difference. You can do this by using switch or an if statement to find the HTTP_HOST and then add (or subtract) the time difference for the one that is different.

      Example:

      $fixdate = $datefromdatabase;
      $siteHost = getenv('HTTP_HOST');
      
      // If [url]http://www.playwork.co.uk/diary.php[/url] is 8 hours ahead add 8 hours to the date.
      
      if($siteHost == "playwork.co.uk") {
           $fixdate = $fixdate + (3600*8);
           }

        If this solved your problem, would you please mark this thread as resolved so others know that a solution was found.

        Thanks

          sorry to be really dim, but how do I do this?

            At the bottom of the page, you will see a link to "Mark thread resolved." This only works for the person who started the topic (or so I've been told... I'm new here myself.)

              Write a Reply...