Sure, this isn't tough at all as long as you keep track of your times.
When the user logs in store the time() in a cookie or database. Then to check the time
since do this
<?php
$oldtime = 1065658402;
$difference = time() - $oldtime;
$timesince = time() - $difference;
echo "Now: ".date("m/d/y g:ia")."<br />\n";
echo "Then: ".date("m/d/y g:ia", $timesince)."<br />\n";
?>
That should be right, I think...
----- Original Message -----
From: Chris W. Parker
To: [EMAIL PROTECTED]
Sent: Wednesday, October 08, 2003 7:34 PM
Subject: [PHP] function to show time passed since event
Hiya.
Tried searching google with no luck on this one.
I'd like a function that when passed a time will spit back in plain
english how much time has passed.
i.e.
You logged in "one hour ago".
<?php
echo "You logged in ".timepassed('2002-08-05 11:24:52').".";
?>
Anyone got da hookup?
Thanks,
Chris.
p.s. Now with signature!
--
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php