GregorianCalendar class Methods in Java Part -III

 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.


isWeekDateSupported(): This method returns true indicating this GregorianCalendarsupports week dates.


roll(int boolean): This method adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields.


roll(int, int): This method adds a signed amount to the specified calendar field without changing larger fields.


set(int, int): This method sets the given calendar field to the given value.


set(int, int, int): This method sets the values for the calendar fields YEAR, MONTH, and DAY_OF_MONTH.


set(int, int, int, int, int): This method sets the values for the calendar fields YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, and MINUTE.


set(int, int, int, int, int, int): This method sets the values for the fields YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, and SECOND.


setFirstDayOfWeek(int):  This method sets the first day of the week.


setGregorianChange(Date): This method sets the GregorianCalendar change date.


setLenient(boolean): This method specifies whether or not date/time interpretation is to be lenient.


setMinimalDaysInFirstWeek(int): This method sets the minimal days required in the first week of the year.


setTime(Date): This method sets this Calendar's time with the given Date.


setTimeInMillis(long): This method sets this Calendar's current time from the given long value.


setTimeZone(TimeZone): This method sets the time zone with the given time zone value.


setWeekDate(int, int, int): This method sets this GregorianCalendar to the date given by the date specifiers - weekYear, weekOfYear, and dayOfWeek.


toInstant(): This method converts this object to an Instant.


toString(): This method returns a string representation of this calendar.


toZonedDateTime(): This method converts this object to a ZonedDateTime that represents the same point on the timeline as this GregorianCalendar.


GregorianCalendar class Methods Part -I


GregorianCalendar class Methods Part -II


No comments:

Post a Comment