Java Calendar - getFirstDayOfWeek() Method
The java.util.Calendar.getFirstDayOfWeek() method is used to get what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
Syntax
public int getFirstDayOfWeek()
Parameters
No parameter is required.
Return Value
Returns the first day of the week.
Exception
NA.
Example:
In the example below, the java.util.Calendar.getFirstDayOfWeek() method is used to get the first day of the week.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating Calendar objects Calendar Cal1 = Calendar.getInstance(Locale.US); Calendar Cal2 = Calendar.getInstance(Locale.FRANCE); //printing the first day of the week System.out.println("First day in US is :" + Cal1.getFirstDayOfWeek()); System.out.println("First day in FRANCE is :" + Cal2.getFirstDayOfWeek()); } }
The output of the above code will be:
First day in US is :1 First day in FRANCE is :2
❮ Java.util - Calendar