The First Day of the Week

From Documentation
Revision as of 09:50, 1 October 2010 by Tomyeh (talk | contribs)


The First Day of the Week


By default, the first day of the week depends on the locale (e.g., Sunday in US, Monday in France). In fact, it is the value returned by the getFirstDayOfWeek method of the java.util.Calendar class.

However, you can configure it different as follows, and it will affect how datebox and calendar components behave.

The Session Attribute: org.zkoss.web.preferred.firstDayOfWeek

[since 5.0.3]

By specify a value to the session attribute called org.zkoss.web.preferred.firstDayOfWeek (i.e., Attributes.PREFERRED_FIRST_DAY_OF_WEEK), you can control the first day of the week for the give session. The allowed value include Calendar.SUNDAY, Calendar.MONDAY and so on.

session.setAttribute(org.zkoss.web.Attributes.PREFERRED_FIRST_DAY_OF_WEEK, java.util.Calendar.SATURDAY);
  //then, the current session's first day of the week will be Saturday

The Application Attribute: org.zkoss.web.preferred.firstDayOfWeek

[since 5.0.3]

By specify a value to the WebApp attribute called org.zkoss.web.preferred.firstDayOfWeek (i.e., Attributes.PREFERRED_FIRST_DAY_OF_WEEK), you can control the first day of the week for the whole application. The allowed value include Calendar.SUNDAY, Calendar.MONDAY and so on.

The session attribute has the higher priority than this.

The Library Property: org.zkoss.web.preferred.firstDayOfWeek

[since 5.0.3]

By specify a value to the library property called org.zkoss.web.preferred.firstDayOfWeek (i.e., Attributes.PREFERRED_FIRST_DAY_OF_WEEK), you can control the first day of the week for the whole application. The allowed values include 1 (Sunday), 2 (Monday), .. and 7 (Saturday).

The session and application attributes have higher priority than this.

<library-property>
	<name>org.zkoss.web.preferred.firstDayOfWeek</name>
	<value>7</value> <!-- 7: Saturday -->
</library-property>

Version History

Version Date Content
     



Last Update : 2010/10/01

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