how can i do it just like Twitter and Facebook does.
how can i do it using php and sql ?
The easiest solution would be to use DateTime:diff()
DateTime:diff()
http://www.php.net/manual/en/datetime.diff.php
Compare time(), which is current, to the database date.