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
import java.util.*;
public class Calendar_Demo {
public static void main(String args[])
{
Calendar calndr
= new GregorianCalendar( 2018 , 6 , 10 );
int min_days
= calndr.getMinimalDaysInFirstWeek();
System.out.println( "The Minimal"
+ " days required: "
+ min_days);
}
}
|
Output:
The Minimal days required: 1
Example 2:
Java
import java.util.*;
public class Calendar_Demo {
public static void main(String args[])
{
Calendar calndr = Calendar.getInstance();
int min_days
= calndr.getMinimalDaysInFirstWeek();
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–
Last Updated :
21 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...