timestamp confusion
| From: | Justin French | Date: | Thu, 21 Feb 2002 03:20:40 +0000 |
| Subject: | timestamp confusion | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85661@lists.php.net to get a copy of this message | ||
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