Java.util.GregorianCalendar.getActualMinimum() Method

Advertisements


Description

The java.util.GregorianCalendar.getActualMinimum(int field) method returns the minimum value that this calendar field could have, taking into consideration the given time value and the current values of the getFirstDayOfWeek, getMinimalDaysInFirstWeek, getGregorianChange and getTimeZone methods.

Declaration

Following is the declaration for java.util.GregorianCalendar.getActualMinimum() method

public int getActualMinimum(int field)

Parameters

  • field -- the calendar field

Return Value

This method returns the minimum of the given field for the time value of this GregorianCalendar

Exception

  • NA

Example

The following example shows the usage of java.util.GregorianCalendar.getActualMinimum() method.

package com.tutorialspoint;

import java.util.*;

public class GregorianCalendarDemo {

   public static void main(String[] args) {

      // create a new calendar
      GregorianCalendar cal = 
              (GregorianCalendar) GregorianCalendar.getInstance();

      // print the current date and time
      System.out.println("" + cal.getTime());

      // get actual minimum for day_of_month
      int min = cal.getActualMinimum(GregorianCalendar.DAY_OF_MONTH);
      System.out.println("Actual Minimum:" + min);

      // get actual minimum for YEAR
      min = cal.getActualMinimum(GregorianCalendar.YEAR);
      System.out.println("Actual Minimum:" + min);

   }
}

Let us compile and run the above program, this will produce the following result:

Fri May 18 02:49:02 EEST 2012
Actual Minimum:1
Actual Minimum:1



Advertisements
Advertisements