Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a timestamp to a relative date/time (e.g., "2 minutes ago") and continuously updating it with Javascript

Does anybody know how did Facebook do that "time ago". I'm trying to do the same with PHP/Javascript

I think it works something like PHP renders timestamp in HTML and then Javascript continuously calculate the time ago; does anybody know any more info about this?

Example of a timestamp formatted as "2 minutes ago"

like image 331
Gandalf StormCrow Avatar asked Apr 10 '10 16:04

Gandalf StormCrow


1 Answers

http://timeago.yarp.com/

This is a great jQuery plugin for it, and it explains the concept quite concisely.

like image 163
brianreavis Avatar answered Nov 09 '22 01:11

brianreavis