Better timestamp explanation to the client
| From: | Ryan A | Date: | Thu, 08 Sep 2005 14:41:08 +0000 |
| Subject: | Better timestamp explanation to the client | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-222027@lists.php.net to get a copy of this message | ||
Hi,
In one of our tables we have these fields:
cust_no bigint(20),
cust_name varchar(30),
last_online datetime,
and in that members profile, if someone visits it, on the top of the page we
have this:
// connect to db, query for record and display it below
Last seen: <?php echo $last_online; ?>
Any ideas on the simplest way to make it look like this:
Last seen: Less than a minute ago!
Last seen: 25 mins ago
Last seen: 2 hours 11 mins ago
Last seen: 1 (or 2 or 3) day/s ago
else{ echo $last_seen; }
I have seen this done on a few sites (Swedish sites actually, I can give you
the URLs if you need them)
I think it looks much better than:
Last seen : 2005-09-07 20:59:01
Thanks!
Ryan