Time() returns unix timestamp (which is GMT), date() is interpreting that
according to the local time zone. 
Tim Ward
internet chess at www.chessish.com <http://www.chessish.com> 

        ----------
        From:  Justin French [SMTP:[EMAIL PROTECTED]]
        Sent:  21 February 2002 03:21
        To:  php
        Subject:  timestamp confusion

        hi,

        when people add something to a table, i'm logging the time()...
later,
        when I pull it out, i'm doing something like date('d M Y',$stamp),
which
        all works fine, printing something like "21 Jan 2002".

        problem is, i'm on a server in canada, but 99% of my users will be
in Australia.

        to get an idea of the time difference, I made a simple php file
called
        time on both my local test server and the live server:

        <?

        $stamp = time();
        echo $stamp."<BR>";
        echo date('d M Y H:m:s', $stamp);

        ?>

        I ran both scripts within 5 seconds of each other, and got the
following:

        local:
        1014261839
        21 Feb 2002 14:02:59

        live:
        1014260440
        20 Feb 2002 21:02:40


        So, if I look at the second line of the output, they're about 17
hours
        behind me, but if I look at the first line [time()] (according to
the
        manual, the number of seconds since that date in 1970 i think), I
get a
        way different result:

        1014261839 - 1014260440 = 1399 seconds difference, about 23 minutes.


        I want to be able to determine the $difference between the two
stamps in
        seconds, then do something like:
        <?
        echo date('d M Y',$stamp - $difference);
        ?>


        Seems easy enough, but 1399 doesn't seem right to me!!!!!

        Where have I lost the plot???


        Justin French
        http://indent.com.au
        http://soundpimps.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to