Fork me on GitHub


Bringig timestamps for humans to you GWT clients. A port of PrettyTime.

If you need "social", relative time references (like 2 hours ago or a century from now) in your GWT application and can't be bothered with rolling your own, you can try this module. It can can be used for reporting both times in the past and in the future, from milliseconds to millenia. It aims to be the GWT "equivalent" to the jQuery "Time Ago" plugin.

Language support


I'll add a few more soon. If you want to contribute, use the as a start.


Add the latest build of gwt-reltime.jar (from the Downloads section) to your GWT project and inherit it in your application's .gwt.xml file like so:

<inherits name="com.projectplace.gwt.reltime.RelativeTime"/>

If you want localized messages, say so:

<extend-property name="locale" values="sv"/>

With that in place, you can use RelativeTime to keep widgets in the GWT client updated with time stamps for humans:

relativeFormatter = new RelativeTime();
relativeFormatter.tend(someWidget, date);

Where someWidget is an object implementing HasText and date is a Java Date instance. The tended widget will get its text updated every minute. You can use the same formatter instance to format several widgets. It's even recommended. But if you need different formatter settings please go ahead and create new instances.

It's your responsibility to tell RelativeTime to stop updating widgets that are no longer in use:


Sometimes (like when a new posting arrives) you want to update all relative time stamps immediately. You do that like so:


When you don't need the auto-updating you can simply convert a date to a relative timestamp String. Like so:

String formattedTime = new RelativeTime().format(date);

Known issues

Some units are large and need more attention. For instance is -2900 years reported as "2 millennia ago".



This started out as port of PrettyTime ( to GWT.


GNU Lesser General Public License




Peter Strömberg (


The library can be used by simply downloading: gwt-reltime.jar Or you can download the project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://