Calendar class getActualMaximum(int field) method example
Calendar class getActualMaximum(int field)method example. This example shows you how to use getActualMaximum(int field) method.This method Returns the maximum value that the specified calendar field could have, given the time value of this Calendar.
Here is the code:-
/**
* @Program that Returns the maximum value that the specified calendar field
* could have, given the time value of this Calendar.
* getactualmaximumcalender.java
* Author:-RoseIndia Team
* Date:-22-May-2008
*/
import java.util.*;
public class getactualmaximumcalender {
public static void main(String[] args) {
//Creating a calender
Calendar cal = Calendar.getInstance() ;
// Returns the maximum value that the specified calendar field
//could have,
int i=cal.getActualMaximum(Calendar.MONTH);
System.out.println("The maximum month that the specified" +
" Calender have =" +i);
}
} |
Output of the program:-
| The maximum month that the specified Calender have =11 |
|