Java Utility Library

Java Calendar - setFirstDayOfWeek() Method



The java.util.Calendar.setFirstDayOfWeek() method is used to set what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.

Syntax

public void setFirstDayOfWeek(int value)

Parameters

value Specify the first day of the week.

Return Value

void type.

Exception

NA

Example:

In the example below, the java.util.Calendar.setFirstDayOfWeek() method is used to set the first day of the week.

import java.util.*;

public class MyClass {
  public static void main(String[] args) {
    //creating Calendar objects
    Calendar Cal = Calendar.getInstance(Locale.FRANCE);

    //printing the first day of the week
    System.out.println("First day in FRANCE is :" + Cal.getFirstDayOfWeek());

    //set the first day of the week
    Cal.setFirstDayOfWeek(1);

    //printing the first day of the week
    System.out.println("First day in FRANCE is :" + Cal.getFirstDayOfWeek());   
  }
}

The output of the above code will be:

First day in FRANCE is :2
First day in FRANCE is :1

❮ Java.util - Calendar