Here you can find the source of createCalendarInstance(final Locale locale)
Parameter | Description |
---|---|
local | the locale to define if a week starts on sunday or monday |
public static Calendar createCalendarInstance(final Locale locale)
//package com.java2s; /**// w w w.j a v a 2 s . c o m * OLAT - Online Learning and Training<br> * http://www.olat.org * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing,<br> * software distributed under the License is distributed on an "AS IS" BASIS, <br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> * See the License for the specific language governing permissions and <br> * limitations under the License. * <p> * Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> * University of Zurich, Switzerland. * <p> */ import java.util.Calendar; import java.util.Locale; public class Main { /** * Create a calendar instance that uses mondays or sundays as the first day of the week depending on the given locale and sets the week number 1 to the first week in * the year that has four days of january. * * @param local the locale to define if a week starts on sunday or monday * @return a calendar instance */ public static Calendar createCalendarInstance(final Locale locale) { // use Calendar.getInstance(locale) that sets first day of week // according to locale or let user decide in GUI final Calendar cal = Calendar.getInstance(locale); // manually set min days to 4 as we are used to have it cal.setMinimalDaysInFirstWeek(4); return cal; } }