Calendar setFirstDayOfWeek() Method in Java with Examples Last Updated : 21 Feb, 2019 Comments Improve Suggest changes Like Article Like Report The setFirstDayOfWeek(int day_val) method in Calendar class is used to set the first day of the week using the day_val in this Calendar. Syntax: public void set(int day_val) Parameters: The method takes one parameter day_val of integer type and refers to the first day of the week. Return Value: The method does not return any value. Below programs illustrate the working of setFirstDayOfWeek() Method of Calendar class: Example 1: Java // Java code to illustrate // setFirstDayOfWeek() method import java.util.*; public class Calendar_Demo { public static void main(String args[]) { // Creating calendar object Calendar calndr = Calendar.getInstance(); // Displaying first day of the week int first_day = calndr.getFirstDayOfWeek(); System.out.println("The Current" + " First day of the week: " + first_day); // Changing the first day of week calndr.setFirstDayOfWeek(Calendar.THURSDAY); // Displaying the alternate day first_day = calndr.getFirstDayOfWeek(); System.out.println("The new first" + " day of the week: " + first_day); } } Output: The Current First day of the week: 1 The new first day of the week: 5 Example 2: Java // Java code to illustrate // setFirstDayOfWeek() method import java.util.*; public class Calendar_Demo { public static void main(String args[]) { // Creating calendar object Calendar calndr = new GregorianCalendar(2018, 6, 10); // Displaying first day of the week int first_day = calndr.getFirstDayOfWeek(); System.out.println("The" + " First day of the week: " + first_day); // Changing the first day of week calndr.setFirstDayOfWeek(Calendar.MONDAY); // Displaying the alternate day first_day = calndr.getFirstDayOfWeek(); System.out.println("The new first" + " day of the week: " + first_day); } } Output: The First day of the week: 1 The new first day of the week: 2 Reference: https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#setFirstDayOfWeek-int- Comment More infoAdvertise with us Next Article Calendar setFirstDayOfWeek() Method in Java with Examples chinmoy lenka Follow Improve Article Tags : Misc Java Java - util package Java-Functions Java-Calendar +1 More Practice Tags : JavaMisc Similar Reads Calendar setTime() Method in Java with Examples The setTime(Date dt) method in Calendar class is used to set Calendars time represented by this Calendar's time value, with the given or passed date as a parameter. Syntax: public final void setTime(Date dt)) Parameters: The method takes one parameter dt of Date type and refers to the given date tha 2 min read Calendar setLenient() Method in Java with Examples The setLenient(boolean leniency) method in Calendar class is used to specify whether the interpretation of the date and time is to be lenient or not. Syntax: public void setLenient(boolean leniency) Parameters: The method takes one parameter leniency of the boolean type that refers to the mode of th 2 min read Calendar get() method in Java with Examples The get(int field_value) method of Calendar class is used to return the value of the given calendar field in the parameter. Syntax: public int get(int field) Parameters: The method takes one parameter field_value of integer type and refers to the calendar whose value is needed to be returned. Return 2 min read Calendar add() Method in Java with Examples The add() method of Calendar class present inside is used to add or subtract from the given calendar field(int field), a specific amount of time(int amt), based on the calendar's rules. Syntax: public abstract void add(int field, int amt) Parameters: The method takes two parameters: The field of the 3 min read Calendar isLenient() Method in Java with Examples The isLenient() method in Calendar class is used to know and understand whether the date and time interpretation of this Calendar is to be considered lenient or not.Syntax: public boolean isLenient() Parameters: The method does not take any parameters.Return Value: The method either returns True if 2 min read Calendar complete() Method in Java with Examples The complete() method in Calendar class is used to fill any unset fields of the calendar fields. It follows the following process of completion: At first, if the time value has not been calculated, the computeTime() method is called to calculate it from calendar field values. Second, to calculate al 2 min read WeekFields of() method in Java with Examples The of() method of WeekFields class helps us to obtain an instance of WeekFields. There are two types of of() methods based on parameters passed to it. of(DayOfWeek firstDayOfWeek, int minimalDaysInFirstWeek): This method helps us to an instance of WeekFields from the first day-of-week and minimal d 2 min read DateFormat setCalendar() Method in Java with Examples The setCalendar() Method of DateFormat class in Java is used to set the calendar associated with this date/time format object. In the initial stage the default settings of calendar is used along with the default locale. Syntax: public void setCalendar(Calendar new_calendar) Parameter: The method tak 2 min read Calendar getMaximum() method in Java with Examples The getMaximum(int calndr_field) method in Calendar class is used to return the maximum value for the given calendar field(int calndr_field) of this Calendar instance. Syntax: public abstract int getMaximum(int calndr_field) Parameters: The method takes one parameter calndr_field that refers to the 2 min read Calendar getMinimum() Method in Java with Examples The getMinimum(int calndr_field) method in Calendar class is used to return the Minimum value for the given calendar field(int calndr_field) of this Calendar instance. Syntax: public abstract int getMinimum(int calndr_field) Parameters: The method takes one parameter calndr_field that refers to the 2 min read Like