- Java.util Package Classes
- Java.util - Home
- Java.util - ArrayDeque
- Java.util - ArrayList
- Java.util - Arrays
- Java.util - BitSet
- Java.util - Calendar
- Java.util - Collections
- Java.util - Currency
- Java.util - Date
- Java.util - Dictionary
- Java.util - EnumMap
- Java.util - EnumSet
- Java.util - Formatter
- Java.util - GregorianCalendar
- Java.util - HashMap
- Java.util - HashSet
- Java.util - Hashtable
- Java.util - IdentityHashMap
- Java.util - LinkedHashMap
- Java.util - LinkedHashSet
- Java.util - LinkedList
- Java.util - ListResourceBundle
- Java.util - Locale
- Java.util - Observable
- Java.util - PriorityQueue
- Java.util - Properties
- Java.util - PropertyPermission
- Java.util - PropertyResourceBundle
- Java.util - Random
- Java.util - ResourceBundle
- Java.util - ResourceBundle.Control
- Java.util - Scanner
- Java.util - ServiceLoader
- Java.util - SimpleTimeZone
- Java.util - Stack
- Java.util - StringTokenizer
- Java.util - Timer
- Java.util - TimerTask
- Java.util - TimeZone
- Java.util - TreeMap
- Java.util - TreeSet
- Java.util - UUID
- Java.util - Vector
- Java.util - WeakHashMap
- Java.util Package Extras
- Java.util - Interfaces
- Java.util - Exceptions
- Java.util - Enumerations
- Java.util Useful Resources
- Java.util - Useful Resources
- Java.util - Discussion
Java Calendar getMinimalDaysInFirstWeek() Method
Description
The Java 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
Getting Minimum Days in First Week from a Current Dated Calendar Instance Example
The following example shows the usage of Java Calendar getMinimalDaysInFirstWeek() method. We're creating an instance of a Calendar of current date using getInstance() method and printing the minimum days in first week of the year using getMinimalDaysInFirstWeek().
package com.tutorialspoint; import java.util.Calendar; public class CalendarDemo { public static void main(String[] args) { // create a calendar Calendar cal = Calendar.getInstance(); // minimum days in first week of the year. System.out.print(cal.getMinimalDaysInFirstWeek()); } }
Output
Let us compile and run the above program, this will produce the following result −
1
Getting Minimum Days in First Week from a Given Dated Calendar Instance Example
The following example shows the usage of Java Calendar getMinimalDaysInFirstWeek() method. We're creating an instance of a Calendar of current date using getInstance() method. Then we've updated the year and printing the minimum days in first week of the year using getMinimalDaysInFirstWeek().
package com.tutorialspoint; import java.util.Calendar; public class CalendarDemo { public static void main(String[] args) { // create a calendar Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2021); // minimum days in first week of the year. System.out.print(cal.getMinimalDaysInFirstWeek()); } }
Output
Let us compile and run the above program, this will produce the following result −
1
Getting Minimum Days in First Week from a Given Dated Calendar Instance Example
The following example shows the usage of Java Calendar getMinimalDaysInFirstWeek() method. We're creating an instance of a Calendar of current date using getInstance() method. Then we've updated the year and printing the minimum days in first week of the year using getMinimalDaysInFirstWeek().
package com.tutorialspoint; import java.util.Calendar; public class CalendarDemo { public static void main(String[] args) { // create a calendar Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2020); // minimum days in first week of the year. System.out.print(cal.getMinimalDaysInFirstWeek()); } }
Output
Let us compile and run the above program, this will produce the following result −
1