GregorianCalendar class Methods in Java Part -I

java.util.GregorianCalendar

GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar system used by most of the world. GregorianCalendar is a hybrid calendar that supports both the Julian and Gregorian calendar systems with the support of a single discontinuity.


Some methods of GregorianCalendar Class.


add(int, int): This method adds 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.


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


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


Constants Part -I: Some constants of GregorianCalendar.example GregorianCalendar.AD


Constants Part -II: Some constants of GregorianCalendar example DAY_OF_MONTH, DATE.


Constants Part -III: Some constants of GregorianCalendar for example DECEMBER, DST_OFFSET.


Constans Part -IV: Some constants of GregorianCalendar for example HOUR, HOUR_OF_DAY.


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


from(ZonedDateTime): This method obtains an instance of GregorianCalendar with the default locale from a ZonedDateTime object.


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


getActualMaximum(int): This method returns the maximum value that this calendar field could have.


getActualMinimum(int): This method returns the minimum value that this calendar field could have.


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


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


getCalendarType(): This method returns "gregory" as the calendar type.


getDisplayName(int, int, Locale): This method returns the string representation of the calendar field value in the given style and locale.


getDisplayNames(int, int, Locale): This method returns a Map containing all names of the calendar field in the given style and locale and their corresponding field values.


Some more Methods of GregorianCalendar Part -II


GregorianCalendar class Methods Part -III


No comments:

Post a Comment