THE Java™ Programming Language, Fourth Edition

(Jeff_L) #1

DAY_OF_WEEK


DAY_OF_WEEK_IN_MONTH


DAY_OF_MONTH


DATE


DAY_OF_YEAR


WEEK_OF_MONTH


WEEK_OF_YEAR


MONTH


YEAR


ERA


ZONE_OFFSET


DST_OFFSET


FIELD_COUNT


An int is used to store values for all these calendar field types. You use these constantsor any others defined
by a particular calendar classto specify a calendar field to the following methods (always as the first
argument):


get Returns the value of the field

set Sets the value of the field to the provided int

clear Clears the value of the field to "unspecified"

isSet Returns true if the field has been set

add Adds an int amount to the specified field

roll Rolls the field up to the next value if the second boolean argument is true,
or down if it is false

getMinimum Gets the minimum valid value for the field

getMaximum Gets the maximum valid value for the field

getGreatestMinimum Gets the highest minimum value for the field; if it varies, this can be different
from getMinimum

getLeastMaximum Gets the smallest maximum value for the field; if it varies, this can be different
from getMaximum

The greatest minimum and least maximum describe cases in which a value can vary within the overall
boundaries. For example, the least maximum value for DAY_OF_MONTH on the Gregorian calendar is 28
because February, the shortest month, can have as few as 28 days. The maximum value is 31 because no

Free download pdf