Calendar class Methods in Java Part -I

 java.util.Calendar

The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the calendar fields, such as getting the date of the next week.

Some methods of  Calendar


add(int, int)This method adds or subtracts the specified amount of time to the given calendar field, based on the calendar's rules.


after(Object)This method returns whether this Calendar represents a time after the time represented by the specified Object.


before(Object)This method returns whether this Calendar represents a time before the time represented by the specified Object.


clear()This method sets all the calendar field values and the time value of this Calendar undefined.


clear(int)This method sets the given calendar field value and the time value of this Calendar undefined.


clone()This method creates and returns a copy of this object.


compareTo(Calendar) This method compares the time values represented by two Calendar objects.


Constants-1 Calendar: Some constants of Calendar class ALL_STYLES, AM. etc..


Constants-2 Calendar: Some constants of Calendar class DST_OFFSET, ERA, etc.


Constants-3 CalendarSome constants of Calendar class NARROW_STANDALONE, PM, etc.


Constants-4 Calendar: Week constants of Calendar class SUNDAY, MONDAY, etc.


Constants-5 Calendar: Month constants of Calendar class JANUARY, FEBRUARY, etc.


equals(Object)This method compares this Calendar to the specified Object. 


get(int)This method returns the value of the given calendar field.


getActualMaximum(int) This method returns the maximum value that the specified calendar field could have, given the time value of this Calendar.


getActualMinimum(int)This method returns the minimum value that the specified calendar field could have, given the time value of this Calendar.


Calendar.getAvailableCalendarTypes()This method returns an unmodifiable Set containing all calendar types supported by Calendar in the runtime environment.


Calendar.getAvailableLocales()This method returns an array of all locales for which the getInstance methods of this class can return localized instances. 


Some more Methods of Calendar class Part -II


Some more Methods of Calendar class Part -III



No comments:

Post a Comment