java.util.Calendar setFirstDayOfWeek(int value)

Description :

This java tutorial shows how to use the setFirstDayOfWeek(int value) method of Calendar class of java.util package. This method sets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.

Method Syntax :

public void setFirstDayOfWeek(int value)

Parameter Input :

 

DataType Parameter Description
int value the given first day of the week.

 

Method Returns :

This method returns void.

Compatibility Version :

Requires Java 1.1 and up

Exception :

N/A

Java Code Example :

This java example source code demonstrates the use of setFirstDayOfWeek(int value) method of Calendar class.

package com.javatutorialhq.java.examples;

import java.util.Calendar;

/*
 * This example source code demonstrates the use of  
 * setFirstDayOfWeek(int value) method of Calendar class
 */

public class CalendarSetFirstDayOfWeekExample {

	public static void main(String[] args) {

		Calendar cal = Calendar.getInstance();
		System.out.println("Current first day of week:"
				+ cal.getFirstDayOfWeek());
		cal.setFirstDayOfWeek(Calendar.FRIDAY);
		System.out.println("New first day of week:" 
				+ cal.getFirstDayOfWeek());
	}
}

Sample Output :

Running the setFirstDayOfWeek(int value) method example source code of Calendar class will give you the following output:

Current first day of week:1
New first day of week:6

Exception Scenario :

N/A

Similar Method :

  • N/A

Suggested Reading List :

References :