Thursday, September 4, 2025
HomeLanguagesJavaCalendar getMinimalDaysInFirstWeek() Method in Java with Examples

Calendar getMinimalDaysInFirstWeek() Method in Java with Examples

The getMinimalDaysInFirstWeek() method in Calendar class is used to return the minimal days that is required in the first week of the needed year.
Syntax: 
 

public int getMinimalDaysInFirstWeek()

Parameters: The method does not take any parameters.
Return Value: The method returns the minimal days required in the first week of the following year.
Below programs illustrate the working of getMinimalDaysInFirstWeek() Method of Calendar class: 
Example 1:
 

Java




// Java code to illustrate
// getMinimalDaysInFirstWeek() method
 
import java.util.*;
 
public class Calendar_Demo {
    public static void main(String args[])
    {
 
        // Creating a calendar
        Calendar calndr
            = new GregorianCalendar(2018, 6, 10);
 
        // Getting the required minimal days
        int min_days
            = calndr.getMinimalDaysInFirstWeek();
 
        // Displaying the results
        System.out.println("The Minimal"
                           + " days required: "
                           + min_days);
    }
}


Output: 

The Minimal days required: 1

 

Example 2: 
 

Java




// Java code to illustrate
// getMinimalDaysInFirstWeek() method
 
import java.util.*;
 
public class Calendar_Demo {
    public static void main(String args[])
    {
 
        // Creating a calendar
        Calendar calndr = Calendar.getInstance();
 
        // Getting the required minimal days
        int min_days
            = calndr.getMinimalDaysInFirstWeek();
 
        // Displaying the results
        System.out.println("The Minimal"
                           + " days required: "
                           + min_days);
    }
}


Output: 

The Minimal days required: 1

 

Reference: https://docs.oracle.com/javase/8/docs/api/java/util/Calendar.html#getMinimalDaysInFirstWeek–
 

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS