Java Week Day getFirstDayOfWeek()

Here you can find the source of getFirstDayOfWeek()

Description

Retrieve the first day of the week using the systems default locale.

License

Open Source License

Return

the first day of the week as defiend in gregoriean calendar for the current default locale.

Declaration

public static int getFirstDayOfWeek() 

Method Source Code


//package com.java2s;
/*//  ww w. j  av a2 s.  c  o  m
 *  File: DateUtils.java 
 *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
 *  A commercial license is available, see http://www.jaret.de.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 */

import java.util.Calendar;

public class Main {
    /** cache for the first day of the week. */
    private static int _firstDayofWeek = -1;

    /**
     * Retrieve the first day of the week using the systems default locale.
     * 
     * @return the first day of the week as defiend in gregoriean calendar for the current default locale.
     */
    public static int getFirstDayOfWeek() {
        if (_firstDayofWeek != -1) {
            return _firstDayofWeek;
        }
        Calendar cal = Calendar.getInstance();
        _firstDayofWeek = cal.getFirstDayOfWeek();
        return _firstDayofWeek;
    }
}

Related

  1. getDaysExceptWeekend(String from, String to)
  2. getDayWithWeek(Date date)
  3. getENWeekDay()
  4. getFirstday_Lastday_Week()
  5. getFirstDayOfLastWeek(Date date)
  6. getFirstDayOfWeek()
  7. getFirstDayOfWeek(Date date)
  8. getFirstDayOfWeek(Date date)
  9. getFirstDayOfWeek(final Date date)