Java.util.Calendar. getMinimalDaysInFirstWeek() Method



Description

The java.util.Calendar.getMinimalDaysInFirstWeek() method gets the minimal days required in the first week of the year needed.

Declaration

Following is the declaration for java.util.Calendar.getMinimalDaysInFirstWeek() method

public int getMinimalDaysInFirstWeek()

Parameters

NA

Return Value

The method returns the minimal days required in the first week of the year.

Exception

NA

Example

The following example shows the usage of java.util.calendar.getMinimalDaysInFirstWeek() method.

package com.tutorialspoint;

import java.util.*;

public class CalendarDemo {
   public static void main(String[] args) {

      // create a calendar
      Calendar cal = Calendar.getInstance();

      // get what the minimal days required in the first week of the year 
      int i = cal.getMinimalDaysInFirstWeek();

      // print the result
      System.out.println("Minimal days required :" + i);
   }
}

Let us compile and run the above program, this will produce the following result −

Minimal days required :4
java_util_calendar.htm
Advertisements