| java.lang.Object java.util.Calendar java.util.GregorianCalendar
GregorianCalendar | public class GregorianCalendar extends Calendar (Code) | | GregorianCalendar provides the conversion between Dates and integer calendar
fields, such as the month, year or minute, for the Gregorian calendar. See
Calendar for the defined fields.
See Also: Calendar See Also: TimeZone See Also: SimpleTimeZone |
Field Summary | |
final public static int | AD Value for the AD era. | final public static int | BC Value for the BC era. | static byte[] | DaysInMonth |
Constructor Summary | |
public | GregorianCalendar() Constructs a new GregorianCalendar initialized to the current date and
time. | public | GregorianCalendar(int year, int month, int day) Constructs a new GregorianCalendar initialized to midnight in the default
time zone on the specified date. | public | GregorianCalendar(int year, int month, int day, int hour, int minute) Constructs a new GregorianCalendar initialized to the specified date and
time. | public | GregorianCalendar(int year, int month, int day, int hour, int minute, int second) Constructs a new GregorianCalendar initialized to the specified date and
time. | | GregorianCalendar(long milliseconds) | public | GregorianCalendar(Locale locale) Constructs a new GregorianCalendar initialized to the current date and
time and using the specified Locale. | public | GregorianCalendar(TimeZone timezone) Constructs a new GregorianCalendar initialized to the current date and
time and using the specified TimeZone. | public | GregorianCalendar(TimeZone timezone, Locale locale) Constructs a new GregorianCalendar initialized to the current date and
time and using the specified TimeZone and Locale. | | GregorianCalendar(boolean ignored) |
Method Summary | |
public void | add(int field, int value) Adds the specified amount to a Calendar field. | public Object | clone() Creates new instance of GregorianCalendar with the same properties. | protected void | computeFields() Computes the Calendar fields from the time. | protected void | computeTime() Computes the time from the Calendar fields. | public boolean | equals(Object object) Compares the specified object to this GregorianCalendar and answer if
they are equal. | public int | getActualMaximum(int field) Gets the maximum value of the specified field for the current date. | public int | getActualMinimum(int field) Gets the minimum value of the specified field for the current date. | public int | getGreatestMinimum(int field) Gets the greatest minimum value of the specified field. | final public Date | getGregorianChange() Answers the gregorian change date of this calendar. | public int | getLeastMaximum(int field) Gets the smallest maximum value of the specified field. | public int | getMaximum(int field) Gets the greatest maximum value of the specified field. | public int | getMinimum(int field) Gets the smallest minimum value of the specified field. | int | getOffset(long localTime) | public int | hashCode() Answers an integer hash code for the receiver. | public boolean | isLeapYear(int year) Answers if the specified year is a leap year. | public void | roll(int field, int value) Adds the specified amount the specified field and wrap the value of the
field when it goes beyond the maximum or minimum value for the current
date. | public void | roll(int field, boolean increment) Increment or decrement the specified field and wrap the value of the
field when it goes beyond the maximum or minimum value for the current
date. | public void | setFirstDayOfWeek(int value) | public void | setGregorianChange(Date date) Sets the gregorian change date of this calendar. | public void | setMinimalDaysInFirstWeek(int value) |
AD | final public static int AD(Code) | | Value for the AD era.
|
BC | final public static int BC(Code) | | Value for the BC era.
|
DaysInMonth | static byte[] DaysInMonth(Code) | | |
GregorianCalendar | public GregorianCalendar()(Code) | | Constructs a new GregorianCalendar initialized to the current date and
time.
|
GregorianCalendar | public GregorianCalendar(int year, int month, int day)(Code) | | Constructs a new GregorianCalendar initialized to midnight in the default
time zone on the specified date.
Parameters: year - the year Parameters: month - the month Parameters: day - the day of the month |
GregorianCalendar | public GregorianCalendar(int year, int month, int day, int hour, int minute)(Code) | | Constructs a new GregorianCalendar initialized to the specified date and
time.
Parameters: year - the year Parameters: month - the month Parameters: day - the day of the month Parameters: hour - the hour Parameters: minute - the minute |
GregorianCalendar | public GregorianCalendar(int year, int month, int day, int hour, int minute, int second)(Code) | | Constructs a new GregorianCalendar initialized to the specified date and
time.
Parameters: year - the year Parameters: month - the month Parameters: day - the day of the month Parameters: hour - the hour Parameters: minute - the minute Parameters: second - the second |
GregorianCalendar | GregorianCalendar(long milliseconds)(Code) | | |
GregorianCalendar | public GregorianCalendar(Locale locale)(Code) | | Constructs a new GregorianCalendar initialized to the current date and
time and using the specified Locale.
Parameters: locale - the Locale |
GregorianCalendar | public GregorianCalendar(TimeZone timezone)(Code) | | Constructs a new GregorianCalendar initialized to the current date and
time and using the specified TimeZone.
Parameters: timezone - the TimeZone |
GregorianCalendar | public GregorianCalendar(TimeZone timezone, Locale locale)(Code) | | Constructs a new GregorianCalendar initialized to the current date and
time and using the specified TimeZone and Locale.
Parameters: timezone - the TimeZone Parameters: locale - the Locale |
GregorianCalendar | GregorianCalendar(boolean ignored)(Code) | | |
add | public void add(int field, int value)(Code) | | Adds the specified amount to a Calendar field.
Parameters: field - the Calendar field to modify Parameters: value - the amount to add to the field exception: IllegalArgumentException - when the specified field is DST_OFFSET or ZONE_OFFSET. |
clone | public Object clone()(Code) | | Creates new instance of GregorianCalendar with the same properties.
a shallow copy of this GregorianCalendar |
computeFields | protected void computeFields()(Code) | | Computes the Calendar fields from the time.
|
computeTime | protected void computeTime()(Code) | | Computes the time from the Calendar fields.
exception: IllegalArgumentException - when the time cannot be computed from the current fieldvalues |
equals | public boolean equals(Object object)(Code) | | Compares the specified object to this GregorianCalendar and answer if
they are equal. The object must be an instance of GregorianCalendar and
have the same properties.
Parameters: object - the object to compare with this object true if the specified object is equal to this GregorianCalendar,false otherwise exception: IllegalArgumentException - when the time is not set and the time cannot be computedfrom the current field values See Also: GregorianCalendar.hashCode |
getActualMaximum | public int getActualMaximum(int field)(Code) | | Gets the maximum value of the specified field for the current date. For
example, the maximum number of days in the current month.
Parameters: field - the field the maximum value of the specified field |
getActualMinimum | public int getActualMinimum(int field)(Code) | | Gets the minimum value of the specified field for the current date. For
the gregorian calendar, this value is the same as
getMinimum() .
Parameters: field - the field the minimum value of the specified field |
getGreatestMinimum | public int getGreatestMinimum(int field)(Code) | | Gets the greatest minimum value of the specified field. For the gregorian
calendar, this value is the same as getMinimum() .
Parameters: field - the field the greatest minimum value of the specified field |
getGregorianChange | final public Date getGregorianChange()(Code) | | Answers the gregorian change date of this calendar. This is the date on
which the gregorian calendar came into effect.
a Date which represents the gregorian change date |
getLeastMaximum | public int getLeastMaximum(int field)(Code) | | Gets the smallest maximum value of the specified field. For example, 28
for the day of month field.
Parameters: field - the field the smallest maximum value of the specified field |
getMaximum | public int getMaximum(int field)(Code) | | Gets the greatest maximum value of the specified field. For example, 31
for the day of month field.
Parameters: field - the field the greatest maximum value of the specified field |
getMinimum | public int getMinimum(int field)(Code) | | Gets the smallest minimum value of the specified field.
Parameters: field - the field the smallest minimum value of the specified field |
getOffset | int getOffset(long localTime)(Code) | | |
hashCode | public int hashCode()(Code) | | Answers an integer hash code for the receiver. Objects which are equal
answer the same value for this method.
the receiver's hash See Also: GregorianCalendar.equals |
isLeapYear | public boolean isLeapYear(int year)(Code) | | Answers if the specified year is a leap year.
Parameters: year - the year true if the specified year is a leap year, false otherwise |
roll | public void roll(int field, int value)(Code) | | Adds the specified amount the specified field and wrap the value of the
field when it goes beyond the maximum or minimum value for the current
date. Other fields will be adjusted as required to maintain a consistent
date.
Parameters: field - the field to roll Parameters: value - the amount to add exception: IllegalArgumentException - when an invalid field is specified |
roll | public void roll(int field, boolean increment)(Code) | | Increment or decrement the specified field and wrap the value of the
field when it goes beyond the maximum or minimum value for the current
date. Other fields will be adjusted as required to maintain a consistent
date. For example, March 31 will roll to April 30 when rolling the month
field.
Parameters: field - the field to roll Parameters: increment - true to increment the field, false to decrement exception: IllegalArgumentException - when an invalid field is specified |
setFirstDayOfWeek | public void setFirstDayOfWeek(int value)(Code) | | |
setGregorianChange | public void setGregorianChange(Date date)(Code) | | Sets the gregorian change date of this calendar.
Parameters: date - a Date which represents the gregorian change date |
setMinimalDaysInFirstWeek | public void setMinimalDaysInFirstWeek(int value)(Code) | | |
Fields inherited from java.util.Calendar | final public static int ERAYEARMONTHWEEK_OF_YEARWEEK_OF_MONTHDATEDAY_OF_MONTHDAY_OF_YEARDAY_OF_WEEKDAY_OF_WEEK_IN_MONTHAM_PMHOURHOUR_OF_DAYMINUTESECONDMILLISECONDZONE_OFFSETDST_OFFSETFIELD_COUNTAMPM(Code)(Java Doc) final public static int JANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUSTSEPTEMBEROCTOBERNOVEMBERDECEMBERUNDECIMBERSUNDAYMONDAYTUESDAYWEDNESDAYTHURSDAYFRIDAYSATURDAY(Code)(Java Doc) protected boolean areFieldsSet(Code)(Java Doc) protected int[] fields(Code)(Java Doc) protected boolean[] isSet(Code)(Java Doc) protected boolean isTimeSet(Code)(Java Doc) transient int lastDateFieldSet(Code)(Java Doc) transient int lastTimeFieldSet(Code)(Java Doc) protected long time(Code)(Java Doc)
|
Methods inherited from java.util.Calendar | abstract public void add(int field, int value)(Code)(Java Doc) public boolean after(Object calendar)(Code)(Java Doc) public boolean before(Object calendar)(Code)(Java Doc) final public void clear()(Code)(Java Doc) final public void clear(int field)(Code)(Java Doc) public Object clone()(Code)(Java Doc) public int compareTo(Calendar anotherCalendar)(Code)(Java Doc) protected void complete()(Code)(Java Doc) abstract protected void computeFields()(Code)(Java Doc) abstract protected void computeTime()(Code)(Java Doc) public boolean equals(Object object)(Code)(Java Doc) public int get(int field)(Code)(Java Doc) public int getActualMaximum(int field)(Code)(Java Doc) public int getActualMinimum(int field)(Code)(Java Doc) public static synchronized Locale[] getAvailableLocales()(Code)(Java Doc) public int getFirstDayOfWeek()(Code)(Java Doc) abstract public int getGreatestMinimum(int field)(Code)(Java Doc) public static synchronized Calendar getInstance()(Code)(Java Doc) public static synchronized Calendar getInstance(Locale locale)(Code)(Java Doc) public static synchronized Calendar getInstance(TimeZone timezone)(Code)(Java Doc) public static synchronized Calendar getInstance(TimeZone timezone, Locale locale)(Code)(Java Doc) abstract public int getLeastMaximum(int field)(Code)(Java Doc) abstract public int getMaximum(int field)(Code)(Java Doc) public int getMinimalDaysInFirstWeek()(Code)(Java Doc) abstract public int getMinimum(int field)(Code)(Java Doc) final public Date getTime()(Code)(Java Doc) public long getTimeInMillis()(Code)(Java Doc) public TimeZone getTimeZone()(Code)(Java Doc) public int hashCode()(Code)(Java Doc) final protected int internalGet(int field)(Code)(Java Doc) public boolean isLenient()(Code)(Java Doc) final public boolean isSet(int field)(Code)(Java Doc) public void roll(int field, int value)(Code)(Java Doc) abstract public void roll(int field, boolean increment)(Code)(Java Doc) public void set(int field, int value)(Code)(Java Doc) final public void set(int year, int month, int day)(Code)(Java Doc) final public void set(int year, int month, int day, int hourOfDay, int minute)(Code)(Java Doc) final public void set(int year, int month, int day, int hourOfDay, int minute, int second)(Code)(Java Doc) public void setFirstDayOfWeek(int value)(Code)(Java Doc) public void setLenient(boolean value)(Code)(Java Doc) public void setMinimalDaysInFirstWeek(int value)(Code)(Java Doc) final public void setTime(Date date)(Code)(Java Doc) public void setTimeInMillis(long milliseconds)(Code)(Java Doc) public void setTimeZone(TimeZone timezone)(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|