Calendar class getMinimalDaysInFirstWeek()method example
Gets what the minimal days required in the first week of the year
Calendar class getMinimalDaysInFirstWeek()method example.This example shows you how to use getMinimalDaysInFirstWeek()method.This method Gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, this method returns 1.
Here is the code:-
/*
* @Program that Gets what the minimal days required in the first week of the
year
* GetMinimalDaysInFirstWeek.java
* Author:-RoseIndia Team
* Date:-23-May-2008
*/
import java.util.*;
public class GetMinimalDaysInFirstWeek {
public static void main(String[] args) {
Calendar c= Calendar.getInstance();
//Gets the days required in the first week of the year
System.out.println("Days required in the first week of the year : "
+c.get(Calendar.DAY_OF_WEEK));
//Gets what the minimal days required in the first week of the year
int i=c.getMinimalDaysInFirstWeek();
System.out.println("Minimal days required in the first week of the year : "+i);
}
} |
Output of the program:-
Days required in the first week of the year : 7
Minimal days required in the first week of the year : 1 |
|