Time() returns unix timestamp (which is GMT), date() is interpreting that
according to the local time zone.
internet chess at www.chessish.com <http://www.chessish.com>
From: Justin French [SMTP:[EMAIL PROTECTED]]
Sent: 21 February 2002 03:21
Subject: timestamp confusion
when people add something to a table, i'm logging the time()...
when I pull it out, i'm doing something like date('d M Y',$stamp),
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
to get an idea of the time difference, I made a simple php file
time on both my local test server and the live server:
$stamp = time();
echo date('d M Y H:m:s', $stamp);
I ran both scripts within 5 seconds of each other, and got the
21 Feb 2002 14:02:59
20 Feb 2002 21:02:40
So, if I look at the second line of the output, they're about 17
behind me, but if I look at the first line [time()] (according to
manual, the number of seconds since that date in 1970 i think), I
way different result:
1014261839 - 1014260440 = 1399 seconds difference, about 23 minutes.
I want to be able to determine the $difference between the two
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???
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php