| Modifier and Type | Field and Description |
|---|---|
static int |
AD |
static int |
BC |
AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FRIDAY, HOUR, HOUR_OF_DAY, isParamSet, isTimeSet, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PARAM_COUNT, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, time, TUESDAY, tzParams, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET| Constructor and Description |
|---|
GregorianCalendar()
Constructs a default GregorianCalendar using the current time in the default time zone.
|
GregorianCalendar(int year,
int month,
int day)
Constructs a GregorianCalendar with the given date and time set for the default time zone.
|
GregorianCalendar(int year,
int month,
int day,
int hrs,
int mins)
Constructs a GregorianCalendar with the given date and time set for the default time zone.
|
GregorianCalendar(int year,
int month,
int day,
int hrs,
int mins,
int secs)
Constructs a GregorianCalendar with the given date and time set for the default time zone.
|
GregorianCalendar(long time)
Constructs a default GregorianCalendar using the specified time in the default time zone.
|
GregorianCalendar(TimeZone timezone)
Constructs a default GregorianCalendar using the specified timezone.
|
GregorianCalendar(TimeZone timezone,
long time)
Constructs a GregorianCalendar based on the current time in the given time zone.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int field,
int amount)
Adds the specified (signed) amount of time to the given calendar field, based on the calendar's rules.
|
boolean |
after(Object when)
Returns whether this Calendar represents a time after the time represented by the specified Object.
|
boolean |
before(Object when)
Returns whether this Calendar represents a time before the time represented by the specified Object.
|
protected void |
computeFields()
Converts the current millisecond time value time to calendar field values in tzParams[].
|
protected void |
computeTime()
Converts the current calendar field values in tzParams[] to the millisecond time value time.
|
boolean |
equals(Object obj)
Compares two Objects for equality.
|
int |
getGreatestMinimum(int i)
Returns the highest minimum value for the given calendar field of this Calendar instance.
|
int |
getLeastMaximum(int i)
Returns the lowest maximum value for the given calendar field of this Calendar instance.
|
int |
getMaximum(int i)
Returns the maximum value for the given calendar field of this Calendar instance.
|
int |
getMinimum(int i)
Returns the minimum value for the given calendar field of this Calendar instance.
|
int |
hashCode()
Returns a hash code value for the object.
|
void |
roll(int i,
boolean flag)
Adds or subtracts (up/down) a single unit of time on the given time field without changing larger tzParams.
|
clear, clear, clone, complete, get, getFirstDayOfWeek, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, getTimeZone, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZonepublic static final int BC
public static final int AD
public GregorianCalendar()
public GregorianCalendar(long time)
public GregorianCalendar(TimeZone timezone)
public GregorianCalendar(int year,
int month,
int day)
year - the value used to set the YEAR calendar field in the calendar.month - the value used to set the MONTH calendar field in the calendar. Month value is 0-based. e.g., 0 for January.day - the value used to set the DAY_OF_MONTH calendar field in the calendar.public GregorianCalendar(int year,
int month,
int day,
int hrs,
int mins)
year - the value used to set the YEAR calendar field in the calendar.month - the value used to set the MONTH calendar field in the calendar. Month value is 0-based. e.g., 0 for January.day - the value used to set the DAY_OF_MONTH calendar field in the calendar.hrs - the value used to set the HOUR_OF_DAY calendar field in the calendar.mins - the value used to set the MINUTE calendar field in the calendar.public GregorianCalendar(int year,
int month,
int day,
int hrs,
int mins,
int secs)
year - the value used to set the YEAR calendar field in the calendar.month - the value used to set the MONTH calendar field in the calendar. Month value is 0-based. e.g., 0 for January.day - the value used to set the DAY_OF_MONTH calendar field in the calendar.hrs - the value used to set the HOUR_OF_DAY calendar field in the calendar.mins - the value used to set the MINUTE calendar field in the calendar.secs - the value used to set the SECOND calendar field in the calendar.public GregorianCalendar(TimeZone timezone, long time)
timezone - the given time zone.public void add(int field,
int amount)
public boolean after(Object when)
public boolean before(Object when)
protected void computeFields()
CalendarcomputeFields in class Calendarprotected void computeTime()
CalendarcomputeTime in class Calendarpublic boolean equals(Object obj)
Object
The equals method implements an equivalence relation:
x,
x.equals(x) should return true.
x and
y, x.equals(y) should return
true if and only if y.equals(x) returns
true.
x,
y, and z, if x.equals(y)
returns true and y.equals(z) returns
true, then x.equals(z) should return
true.
x
and y, multiple invocations of x.equals(y)
consistently return true or consistently return
false.
x, x.equals(null)
should return false.
The equals method for class Object implements the most
discriminating possible equivalence relation on objects; that is,
for any reference values x and y, this
method returns true if and only if x and
y refer to the same object (x==y has the
value true).
equals in class Calendarobj - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Boolean.hashCode(),
Hashtablepublic int getGreatestMinimum(int i)
CalendargetGreatestMinimum in class Calendari - ?public int getLeastMaximum(int i)
CalendargetLeastMaximum in class Calendari - ?public int getMaximum(int i)
CalendargetMaximum in class Calendari - ?public int getMinimum(int i)
CalendargetMinimum in class Calendari - ?public int hashCode()
Objectjava.util.Hashtable.
The general contract of hashCode is:
hashCode method
must consistently return the same integer. This integer need not
remain consistent from one execution of an application to another
execution of the same application.
equals
method, then calling the hashCode method on each of the
two objects must produce the same integer result.
hashCode in class ObjectObject.equals(java.lang.Object),
Hashtablepublic void roll(int i,
boolean flag)
Calendar