SeamFramework.orgCommunity Documentation

Chapter 38. Timezones

38.1. Joda Time
38.2. Application TimeZone
38.3. User TimeZone
38.4. Available TimeZones

To support a more developer friendly way of handling TimeZones, in addition to supporting JDK TimeZone, we have added support for using Joda-Time through their DateTimeZone class. Don't worry, it provides convenience methods for converting to JDK TimeZone.

To activate Joda-Time for i18n within your project you will need to add the following Maven dependency:


We have an Application time zone that is available with Joda-Time (DateTimeZone) or the JDK (TimeZone) that can be retrieved with


private DateTimeZone applicationDateTimeZone;
private TimeZone applicationTimeZone

It can also be accessed through EL by the name "defaultDateTimeZone" for Joda-Time or "defaultTimeZone" for JDK!

By default the TimeZone will be set to the JVM default, unless you produce a String annotated with @DefaultTimeZone. This can be achieved through either the Seam Config module or any bean that @Produces a method or field that matches the type and qualifier.

This will set the application time zone to be Tijuana:


private String defaultTimeZoneId = "America/Tijuana";

In addition to the Application time zone, there is also a time zone assigned to each User Session.


private DateTimeZone userDateTimeZone;
private TimeZone userTimeZone;

It can also be accessed through EL using "userDateTimeZone" for Joda-Time and "userTimeZone" for JDK.

By default the DateTimeZone and TimeZone for a User Session is initialized to the same as the Application. However, changing the User's DateTimeZone and TimeZone is a simple matter of firing an event to update it. An example would be


private Event<DateTimeZone> dtzEvent;
private Event<TimeZone> tzEvent;
public void setUserDateTimeZone() {
    DateTimeZone dtzTijuana = DateTimeZone.forID("America/Tijuana");;
    TimeZone tzTijuana = TimeZone.getTimeZone("America/Tijuana");;

We've also provided a list of available TimeZones that can be accessed via


private List<ForwardingDateTimeZone> dateTimeZones;
private List<ForwardingTimeZone> timeZones;