Tuesday 3 July 2018

How to use getActualMinimum(int field) method of Java.util.calendar class


Click here to watch on Youtube: 
https://www.youtube.com/watch?v=VhDu9IN8EeY&list=UUhwKlOVR041tngjerWxVccw

CalendarDemo.java

import java.util.Calendar;

public class CalendarDemo
{
    public static void main(String[] args)
    {
        Calendar cal = Calendar.getInstance();

        /*
         * public int getActualMinimum(int field)
         *
         * Parameters:
         *
         * field - the calendar field
         *
         * Returns:
         *
         * the minimum of the given calendar field for the time value
         * of this Calendar
         */


        // get the minimum value that year field can have
        int minYear = cal.getActualMinimum(Calendar.YEAR);
        System.out.println("Minimum year = " + minYear);

        // get the minimum value that month field can have
        int minMonth = cal.getActualMinimum(Calendar.MONTH);
        System.out.println("Minimum month = " + minMonth);

    }

}

Output

Minimum year = 1
Minimum month = 0

Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/CalendarDemo_getActualMinimum.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/CalendarDemo_getActualMinimum

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/08a35bef4ef43a64446d7182fc58e2891a472c27/BasicJava_2018/CalendarDemo_getActualMinimum/?at=master

See also:
  • All JavaEE Videos Playlist
  • All JavaEE Videos
  • All JAVA EE Links
  • Spring Tutorial
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • Cooking Tutorial
  • No comments:

    Post a Comment