Java java.util GregorianCalendar fields, constructors, methods, implement or subclass

Example usage for Java java.util GregorianCalendar fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for java.util GregorianCalendar.

The text is from its open source code.

Subclass

java.util.GregorianCalendar has subclasses.
Click this link to see all its subclasses.

Field

intBC
Value of the ERA field indicating the period before the common era (before Christ), also known as BCE.
intAD
Value of the ERA field indicating the common era (Anno Domini), also known as CE.

Constructor

GregorianCalendar()
Constructs a default GregorianCalendar using the current time in the default time zone with the default Locale.Category#FORMAT FORMAT locale.
GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay, int minute, int second)
Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.
GregorianCalendar(int year, int month, int dayOfMonth, int hourOfDay, int minute)
Constructs a GregorianCalendar with the given date and time set for the default time zone with the default locale.
GregorianCalendar(int year, int month, int dayOfMonth)
Constructs a GregorianCalendar with the given date set in the default time zone with the default locale.
GregorianCalendar(TimeZone zone, Locale locale, boolean flag)
Constructs an empty GregorianCalendar.
GregorianCalendar(TimeZone zone)
Constructs a GregorianCalendar based on the current time in the given time zone with the default Locale.Category#FORMAT FORMAT locale.
GregorianCalendar(Locale aLocale)
Constructs a GregorianCalendar based on the current time in the default time zone with the given locale.
GregorianCalendar(TimeZone zone, Locale aLocale)
Constructs a GregorianCalendar based on the current time in the given time zone with the given locale.

Method

voidadd(int field, int amount)
Adds the specified (signed) amount of time to the given calendar field, based on the calendar's rules.
booleanafter(Object when)
Returns whether this Calendar represents a time after the time represented by the specified Object.
booleanbefore(Object when)
Returns whether this Calendar represents a time before the time represented by the specified Object.
voidclear()
Sets all the calendar field values and the time value (millisecond offset from the Epoch) of this Calendar undefined.
voidclear(int field)
Sets the given calendar field value and the time value (millisecond offset from the Epoch) of this Calendar undefined.
Objectclone()
intcompareTo(Calendar anotherCalendar)
Compares the time values (millisecond offsets from the Epoch) represented by two Calendar objects.
booleanequals(Object obj)
Compares this GregorianCalendar to the specified Object.
GregorianCalendarfrom(ZonedDateTime zdt)
Obtains an instance of GregorianCalendar with the default locale from a ZonedDateTime object.
intget(int field)
Returns the value of the given calendar field.
intgetActualMaximum(int field)
Returns the maximum value that this calendar field could have, taking into consideration the given time value and the current values of the Calendar#getFirstDayOfWeek() getFirstDayOfWeek , Calendar#getMinimalDaysInFirstWeek() getMinimalDaysInFirstWeek , #getGregorianChange() getGregorianChange and Calendar#getTimeZone() getTimeZone methods.
intgetActualMinimum(int field)
Returns the minimum value that this calendar field could have, taking into consideration the given time value and the current values of the Calendar#getFirstDayOfWeek() getFirstDayOfWeek , Calendar#getMinimalDaysInFirstWeek() getMinimalDaysInFirstWeek , #getGregorianChange() getGregorianChange and Calendar#getTimeZone() getTimeZone methods.
ClassgetClass()
Returns the runtime class of this Object .
StringgetDisplayName(int field, int style, Locale locale)
Returns the string representation of the calendar field value in the given style and locale.
intgetFirstDayOfWeek()
Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
intgetGreatestMinimum(int field)
Returns the highest minimum value for the given calendar field of this GregorianCalendar instance.
DategetGregorianChange()
Gets the Gregorian Calendar change date.
CalendargetInstance()
Gets a calendar using the default time zone and locale.
intgetLeastMaximum(int field)
Returns the lowest maximum value for the given calendar field of this GregorianCalendar instance.
intgetMaximum(int field)
Returns the maximum value for the given calendar field of this GregorianCalendar instance.
intgetMinimum(int field)
Returns the minimum value for the given calendar field of this GregorianCalendar instance.
DategetTime()
Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
longgetTimeInMillis()
Returns this Calendar's time value in milliseconds.
TimeZonegetTimeZone()
intgetWeeksInWeekYear()
Returns the number of weeks in the week year represented by this GregorianCalendar .
intgetWeekYear()
Returns the week year represented by this GregorianCalendar .
inthashCode()
Generates the hash code for this GregorianCalendar object.
booleanisLeapYear(int year)
Determines if the given year is a leap year.
booleanisWeekDateSupported()
Returns true indicating this GregorianCalendar supports week dates.
voidroll(int field, boolean up)
Adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields.
voidroll(int field, int amount)
Adds a signed amount to the specified calendar field without changing larger fields.
voidset(int year, int month, int date)
Sets the values for the calendar fields YEAR, MONTH, and DAY_OF_MONTH.
voidset(int field, int value)
Sets the given calendar field to the given value.
voidset(int year, int month, int date, int hourOfDay, int minute, int second)
Sets the values for the fields YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, and SECOND.
voidsetFirstDayOfWeek(int value)
Sets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
voidsetGregorianChange(Date date)
Sets the GregorianCalendar change date.
voidsetGregorianChange(long cutoverTime)
voidsetLenient(boolean lenient)
Specifies whether or not date/time interpretation is to be lenient.
voidsetTime(Date date)
Sets this Calendar's time with the given Date.
voidsetTimeInMillis(long millis)
Sets this Calendar's current time from the given long value.
voidsetTimeZone(TimeZone zone)
voidsetWeekDate(int weekYear, int weekOfYear, int dayOfWeek)
Sets this GregorianCalendar to the date given by the date specifiers - weekYear , weekOfYear , and dayOfWeek .
StringtoString()
Return a string representation of this calendar.
ZonedDateTimetoZonedDateTime()
Converts this object to a ZonedDateTime that represents the same point on the time-line as this GregorianCalendar .