Calendar getMinimalDaysInFirstWeek() in Java

getMinimalDaysInFirstWeek(): This method is available in java.util.Calendar class of Java.

Syntax:

int java.util.Calendar.getMinimalDaysInFirstWeek()

This method gets what the minimal days required in the first week of the year.

Parameters: NA

Returns: the minimal days required in the first week of the year.

Exceptions: NA

Approach

Java

import java.util.Calendar;

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

        // create a calendar
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 2);

        System.out.println(calendar.getMinimalDaysInFirstWeek());
    }
}

Output:

1


No comments:

Post a Comment