Date and Time Formatting

From Documentation
Revision as of 06:30, 25 April 2011 by Tomyeh (talk | contribs)


Date and Time Formatting


Overview

By default, the format of date and time, especially the format of Datebox and Timebox, is determined by the JVM's default and the current locale.

In this section, we will discuss how to configure ZK to use the format other than the JVM. For example, you could configure ZK to use the preferred format based on user's preferences.

The Decision Sequence of Format

The format of date and time is decided in the following sequence.

  1. It checks if an attribute called org.zkoss.web.preferred.dateFormatInfo defined in the HTTP session (i.e., Session). If so, it will be used by assuming the value is an instance or a class of DateFormatInfo.
  2. It checks if an attribute called org.zkoss.web.preferred.dateFormatInfo defined in the servlet context (i.e., Application). If so, it will be used by assuming the value is an instance or a class of DateFormatInfo.
  3. It checks if a property called org.zkoss.web.preferred.dateFormatInfo defined in the library property (i.e., Library). If so, it will be used by assuming the value is a class of DateFormatInfo.

With this sequence in mind, you could configure ZK to use the correct format based on the application requirements.

Application-level Format

Per-user Format

Per-component Format

Version History

Last Update : 2011/04/25


Version Date Content
5.0.7 April 2011 The per-session format of datebox/timebox was introduced. Prior to 5.0.7, the format depends only on locale.



Last Update : 2011/04/25

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