How to Convert Time in Milliseconds into Relative Time Format in Android

Relative time format like “moments ago” or “5 minutes ago” or “one month ago” like those in Facebook, Twitter or other social media makes the time information easy to read and human readable. In Android we can use built in API DateUtils or external java library Prettytime to implement this feature.

Prettytime is an open source formatting time library from ocpsoft.org to create a human readable relative time format. As the name implied, this library really makes the time format very pretty and friendly just like those we’ve seen in Facebook, Twitter or other social media. To use this library, download jar file and copy it into “libs” directory under Android project directory.