Java Date Time - Java Calendar .setMinimalDaysInFirstWeek ( int value)








Syntax

Calendar.setMinimalDaysInFirstWeek(int value) has the following syntax.

public void setMinimalDaysInFirstWeek(int value)

Example

In the following code shows how to use Calendar.setMinimalDaysInFirstWeek(int value) method.

//from  w  ww  .j av  a 2 s .  co  m

import java.util.Calendar;

public class Main {

   public static void main(String[] args) {
      Calendar cal = Calendar.getInstance();

      // get what is the minimal days required in the first week
      int min = cal.getMinimalDaysInFirstWeek();
      System.out.println("Minimal Days in Week: " + min);

      // set the minimal days required in the first week
      cal.setMinimalDaysInFirstWeek(2);

      // print the result
      min = cal.getMinimalDaysInFirstWeek();
      System.out.println("Minimal Days in Week: " + min);
   }
}

The code above generates the following result.