The First Day of the Week"

From Documentation
Line 21: Line 21:
 
  [since 5.0.3]
 
  [since 5.0.3]
  
By specify a value to the <javadoc type="interface">org.zkoss.zk.ui.WebApp</javadoc> attribute called <javadoc>org.zkoss.web.preferred.firstDayOfWeek</javadoc> (i.e., <javadoc method="PREFERRED_FIRST_DAY_OF_WEEK">org.zkoss.web.Attributes</javadoc>), you can control the first day of the week for the whole application.
+
By specify a value to the <javadoc type="interface">org.zkoss.zk.ui.WebApp</javadoc> attribute called <tt>org.zkoss.web.preferred.firstDayOfWeek</tt> (i.e., <javadoc method="PREFERRED_FIRST_DAY_OF_WEEK">org.zkoss.web.Attributes</javadoc>), 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 allowed value include Calendar.SUNDAY, Calendar.MONDAY and so on.
  

Revision as of 02:39, 27 July 2010

The First Day of the Week


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


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 Attributes.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>



Last Update : 2010/07/27

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