I’m looking for a PHP date helper function that can compute like Twitter:
20 seconds ago
3 minutes ago
1 hour ago
2 hours ago
1 days ago
etc.
I’m using a datetime column in the database to store the history. Should this functionality be done on the database level or on the PHP level?
It’s much better to compute ‘X minutes ago’ in the browser if you can help it so that you don’t miss caching opportunities unnecessarily.
http://timeago.yarp.com/ is a nice jQuery plugin for doing just that.