Time Zone

From Documentation

Stop.png This documentation is for an older version of ZK. For the latest one, please click here.


The time zone used to process requests and events is, by default, determined by the JVM's preferences (by use of the getDefault method of java.util.TimeZone).

Note: Unlike locale, there is no standard way to determine the time zone for each browser.

Like Locale, the time zone for a given application and session is configurable. For example, you might want to use the preferred time zone that a user specified in his or her profile, if you maintain user profiles in the server.


The Application Attribute: px_preferred_time_zone

[Since 3.6.3]

If you want to use the same time zone for all users, you can specify the time zone in the application attribute (WebApp, aka., ServletContext) called px_preferred_time_zone.

Tip: To avoid typo, you can use the constant: Attributes.PREFERRED_TIME_ZONE.

The Session Attribute: px_preferred_time_zone

ZK will check if a session attribute called px_preferred_time_zone is defined. If defined, it uses as the default time zone for the session instead of the system default. Thus, you can control the time zone of a session by storing the preferred time zone in this attribute, after, say, a user logins as depicted in the previous section.

Tip: To avoid typo, you can use the constant: Attributes.PREFERRED_TIME_ZONE

The Request Interceptor

Like Locale, you can prepare the time zone for the given session by use of the request interceptor.



Last Update : 2010/10/01

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.