.setMinimalDaysInFirstWeek()
Anonymous contributor
Anonymous contributor2 total contributions
Anonymous contributor
Published Sep 10, 2023
Contribute to Docs
The .setMinimalDaysInFirstWeek()
method of the Calendar
class sets the minimal number of days required in the first week of a year based on the the amount of days passed as an argument to the method.
Syntax
calendar.setMinimalDaysInFirstWeek(int day)
This method takes only one argument, int day
, which is an integer constant representing the number of days which will be set as the minimal days required in the first week of the year.
Example
In the following example, .setMinimalDaysInFirstWeek()
is used to set the minimal days required in the first week of the year.
import java.util.Calendar;public class calendarSetMinimalDaysInFirstWeekExample {public static void main(String[] args) {// Create a calendar instanceCalendar cal = Calendar.getInstance();// Set the minimal days required in the first weekint day = 2;cal.setMinimalDaysInFirstWeek(day);// Print the minimal number of days required in the first weekint min = cal.getMinimalDaysInFirstWeek();System.out.println("Minimal Days in Week: " + min);}}
The output of the above code will be:
Minimal Days in Week: 2
All contributors
- Anonymous contributorAnonymous contributor2 total contributions
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.