Reputation: 10509
On Facebook, each comment or other user event has a timestamp. But it is not listed as a simple date, but presented in a form of a human-friendly string. For example if right now it is 08:38 and the comment was made at 08:31, Facebook doesn't just tell you the time, but says "7 minutes ago".
Is there an open source implementation of Facebook algorithm (or similar) that takes a data of event, a current date and tells in a human-friendly form how long has it been since?
Upvotes: 0
Views: 847
Reputation: 5040
You could dig into timeago jQuery plugin's source code to study.
Upvotes: 1
Reputation: 1607
What I think that should be the best is this :
Most of the languages provide the datediff method . Like in PHP you can use it like this
Upvotes: 0
Reputation: 3650
Pretty date http://ejohn.org/projects/javascript-pretty-date/ is a good javascript library for this
Upvotes: 4