Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smart time calculation [closed]

Tags:

java

date

android

I'm looking for some standard and algorithm (may be library) to present when some event happens. What I mean - fo ex. if someone post message 2 minutes ago - I want to display "2 min ago" instead full date and time "12-sep-13 5:17 PM". Then after hour - "An hour ago" ...

I want to know may be exist some standard - for ex. "2 days ago" - it's correct, but instead "3 days ago" I must display full date.

May be some one knows some library or use own elegant algorithm.
If you share it - will be helpful.(I don't want to reinvent the bicycle)

like image 417
jimpanzer Avatar asked Sep 14 '26 10:09

jimpanzer


1 Answers

Please check this page and this lib (JodaTime). This lib is not small but maybe it will help you.

like image 80
x90 Avatar answered Sep 16 '26 01:09

x90