| 
 | " 2013 FRC Java API" | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Calendar
public abstract class Calendar
Calendar is an abstract base class for converting between
 a Date object and a set of integer fields such as
 YEAR, MONTH, DAY, HOUR,
 and so on. (A Date object represents a specific instant in
 time with millisecond precision. See
 Date
 for information about the Date class.)
 
 Subclasses of Calendar interpret a Date
 according to the rules of a specific calendar system.
 
 Like other locale-sensitive classes, Calendar provides a
 class method, getInstance, for getting a generally useful
 object of this type.
 
Calendar rightNow = Calendar.getInstance();
 A Calendar object can produce all the time field values
 needed to implement the date-time formatting for a particular language
 and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).
 
 When computing a Date from time fields,
 there may be insufficient information to compute the
 Date (such as only year and month but no day in the month).
 
 Insufficient information. The calendar will use default
 information to specify the missing fields. This may vary by calendar; for
 the Gregorian calendar, the default for a field is the same as that of the
 start of the epoch: i.e., YEAR = 1970, MONTH = JANUARY, DATE = 1, etc.
 Note: The ambiguity in interpretation of what day midnight
 belongs to, is resolved as so: midnight "belongs" to the following day.
 23:59 on Dec 31, 1969 < 00:00 on Jan 1, 1970.
 12:00 PM is midday, and 12:00 AM is midnight.
 11:59 PM on Jan 1 < 12:00 AM on Jan 2 < 12:01 AM on Jan 2.
 11:59 AM on Mar 10 < 12:00 PM on Mar 10 < 12:01 PM on Mar 10.
 24:00 or greater are invalid.
 Hours greater than 12 are invalid in AM/PM mode.
 Setting the time will never change the date.
 
If equivalent times are entered in AM/PM or 24 hour mode, equality will be determined by the actual time rather than the entered time.
This class has been subset for J2ME based on the JDK 1.3 Calendar class. Many methods and variables have been pruned, and other methods simplified, in an effort to reduce the size of this class.
Date, 
TimeZone| Field Summary | |
|---|---|
| static int | AMValue of the AM_PMfield indicating the
 period of the day from midnight to just before noon. | 
| static int | AM_PMField number for getandsetindicating
 whether theHOURis before or after noon. | 
| static int | APRILValue of the MONTHfield indicating the
 fourth month of the year. | 
| static int | AUGUSTValue of the MONTHfield indicating the
 eighth month of the year. | 
| static int | DATEField number for getandsetindicating the
 day of the month. | 
| static int | DAY_OF_MONTHField number for getandsetindicating the
 day of the month. | 
| static int | DAY_OF_WEEKField number for getandsetindicating the
 day of the week. | 
| static int | DECEMBERValue of the MONTHfield indicating the
 twelfth month of the year. | 
| static int | FEBRUARYValue of the MONTHfield indicating the
 second month of the year. | 
| protected  int[] | fieldsThe field values for the currently set time for this calendar. | 
| static int | FRIDAYValue of the DAY_OF_WEEKfield indicating
 Friday. | 
| static int | HOURField number for getandsetindicating the
 hour of the morning or afternoon. | 
| static int | HOUR_OF_DAYField number for getandsetindicating the
 hour of the day. | 
| protected  boolean[] | isSetThe flags which tell if a specified time field for the calendar is set. | 
| static int | JANUARYValue of the MONTHfield indicating the
 first month of the year. | 
| static int | JULYValue of the MONTHfield indicating the
 seventh month of the year. | 
| static int | JUNEValue of the MONTHfield indicating the
 sixth month of the year. | 
| static int | MARCHValue of the MONTHfield indicating the
 third month of the year. | 
| static int | MAYValue of the MONTHfield indicating the
 fifth month of the year. | 
| static int | MILLISECONDField number for getandsetindicating the
 millisecond within the second. | 
| static int | MINUTEField number for getandsetindicating the
 minute within the hour. | 
| static int | MONDAYValue of the DAY_OF_WEEKfield indicating
 Monday. | 
| static int | MONTHField number for getandsetindicating the
 month. | 
| static int | NOVEMBERValue of the MONTHfield indicating the
 eleventh month of the year. | 
| static int | OCTOBERValue of the MONTHfield indicating the
 tenth month of the year. | 
| static int | PMValue of the AM_PMfield indicating the
 period of the day from noon to just before midnight. | 
| static int | SATURDAYValue of the DAY_OF_WEEKfield indicating
 Saturday. | 
| static int | SECONDField number for getandsetindicating the
 second within the minute. | 
| static int | SEPTEMBERValue of the MONTHfield indicating the
 ninth month of the year. | 
| static int | SUNDAYValue of the DAY_OF_WEEKfield indicating
 Sunday. | 
| static int | THURSDAYValue of the DAY_OF_WEEKfield indicating
 Thursday. | 
| protected  long | timeThe currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT. | 
| static int | TUESDAYValue of the DAY_OF_WEEKfield indicating
 Tuesday. | 
| static int | WEDNESDAYValue of the DAY_OF_WEEKfield indicating
 Wednesday. | 
| static int | YEARField number for getandsetindicating the
 year. | 
| Constructor Summary | |
|---|---|
| protected  | Calendar()Constructs a Calendar with the default time zone. | 
| Method Summary | |
|---|---|
|  boolean | after(Object when)Compares the time field records. | 
|  boolean | before(Object when)Compares the time field records. | 
| protected abstract  void | computeFields()Converts the current millisecond time value timeto field values infields[]. | 
| protected abstract  void | computeTime()Converts the current field values in fields[]to the millisecond time valuetime. | 
|  boolean | equals(Object obj)Compares this calendar to the specified object. | 
|  int | get(int field)Gets the value for a given time field. | 
| static Calendar | getInstance()Gets a calendar using the default time zone. | 
| static Calendar | getInstance(TimeZone zone)Gets a calendar using the specified time zone. | 
|  Date | getTime()Gets this Calendar's current time. | 
| protected  long | getTimeInMillis()Gets this Calendar's current time as a long expressed in milliseconds after January 1, 1970, 0:00:00 GMT (the epoch). | 
|  TimeZone | getTimeZone()Gets the time zone. | 
|  void | set(int field,
    int value)Sets the time field with the given value. | 
|  void | setTime(Date date)Sets this Calendar's current time with the given Date. | 
| protected  void | setTimeInMillis(long millis)Sets this Calendar's current time from the given long value. | 
|  void | setTimeZone(TimeZone value)Sets the time zone with the given time zone value. | 
| Methods inherited from class java.lang.Object | 
|---|
| getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int YEAR
get and set indicating the
 year. This is a calendar-specific value.
public static final int MONTH
get and set indicating the
 month. This is a calendar-specific value.
public static final int DATE
get and set indicating the
 day of the month. This is a synonym for DAY_OF_MONTH.
DAY_OF_MONTH, 
Constant Field Valuespublic static final int DAY_OF_MONTH
get and set indicating the
 day of the month. This is a synonym for DATE.
DATE, 
Constant Field Valuespublic static final int DAY_OF_WEEK
get and set indicating the
 day of the week.
public static final int AM_PM
get and set indicating
 whether the HOUR is before or after noon.
 E.g., at 10:04:15.250 PM the AM_PM is PM.
AM, 
PM, 
HOUR, 
Constant Field Valuespublic static final int HOUR
get and set indicating the
 hour of the morning or afternoon. HOUR is used for the
 12-hour clock.
 E.g., at 10:04:15.250 PM the HOUR is 10.
AM_PM, 
HOUR_OF_DAY, 
Constant Field Valuespublic static final int HOUR_OF_DAY
get and set indicating the
 hour of the day. HOUR_OF_DAY is used for the 24-hour clock.
 E.g., at 10:04:15.250 PM the HOUR_OF_DAY is 22.
public static final int MINUTE
get and set indicating the
 minute within the hour.
 E.g., at 10:04:15.250 PM the MINUTE is 4.
public static final int SECOND
get and set indicating the
 second within the minute.
 E.g., at 10:04:15.250 PM the SECOND is 15.
public static final int MILLISECOND
get and set indicating the
 millisecond within the second.
 E.g., at 10:04:15.250 PM the MILLISECOND is 250.
public static final int SUNDAY
DAY_OF_WEEK field indicating
 Sunday.
public static final int MONDAY
DAY_OF_WEEK field indicating
 Monday.
public static final int TUESDAY
DAY_OF_WEEK field indicating
 Tuesday.
public static final int WEDNESDAY
DAY_OF_WEEK field indicating
 Wednesday.
public static final int THURSDAY
DAY_OF_WEEK field indicating
 Thursday.
public static final int FRIDAY
DAY_OF_WEEK field indicating
 Friday.
public static final int SATURDAY
DAY_OF_WEEK field indicating
 Saturday.
public static final int JANUARY
MONTH field indicating the
 first month of the year.
public static final int FEBRUARY
MONTH field indicating the
 second month of the year.
public static final int MARCH
MONTH field indicating the
 third month of the year.
public static final int APRIL
MONTH field indicating the
 fourth month of the year.
public static final int MAY
MONTH field indicating the
 fifth month of the year.
public static final int JUNE
MONTH field indicating the
 sixth month of the year.
public static final int JULY
MONTH field indicating the
 seventh month of the year.
public static final int AUGUST
MONTH field indicating the
 eighth month of the year.
public static final int SEPTEMBER
MONTH field indicating the
 ninth month of the year.
public static final int OCTOBER
MONTH field indicating the
 tenth month of the year.
public static final int NOVEMBER
MONTH field indicating the
 eleventh month of the year.
public static final int DECEMBER
MONTH field indicating the
 twelfth month of the year.
public static final int AM
AM_PM field indicating the
 period of the day from midnight to just before noon.
public static final int PM
AM_PM field indicating the
 period of the day from noon to just before midnight.
protected int[] fields
protected boolean[] isSet
FIELD_COUNT booleans,
protected long time
| Constructor Detail | 
|---|
protected Calendar()
TimeZone.getDefault()| Method Detail | 
|---|
public final Date getTime()
setTime(java.util.Date)public final void setTime(Date date)
 Note: Calling setTime() with
 Date(Long.MAX_VALUE) or Date(Long.MIN_VALUE)
 may yield incorrect field values from get().
date - the given Date.getTime()public static Calendar getInstance()
public static Calendar getInstance(TimeZone zone)
zone - the time zone to use
protected long getTimeInMillis()
setTimeInMillis(long)protected void setTimeInMillis(long millis)
millis - the new time in UTC milliseconds from the epoch.getTimeInMillis()public final int get(int field)
field - the given time field (either YEAR, MONTH, DATE, DAY_OF_WEEK,
                                    HOUR_OF_DAY, HOUR, AM_PM, MINUTE,
                                    SECOND, or MILLISECOND
ArrayIndexOutOfBoundsException - if the parameter is not
 one of the above.
public final void set(int field,
                      int value)
field - the given time field.value - the value to be set for the given time field.
ArrayIndexOutOfBoundsException - if an illegal field
 parameter is received.public boolean equals(Object obj)
true if and only if the argument is
 not null and is a Calendar object that
 represents the same calendar as this object.
equals in class Objectobj - the object to compare with.
true if the objects are the same;
 false otherwise.Boolean.hashCode(), 
Hashtablepublic boolean before(Object when)
when - the Calendar to be compared with this Calendar.
public boolean after(Object when)
when - the Calendar to be compared with this Calendar.
public void setTimeZone(TimeZone value)
value - the given time zone.getTimeZone()public TimeZone getTimeZone()
setTimeZone(java.util.TimeZone)protected abstract void computeFields()
time
 to field values in fields[].
 This allows you to sync up the time field values with
 a new time that is set for the calendar.
protected abstract void computeTime()
fields[]
 to the millisecond time value
 time.
| 
 | " 2013 FRC Java API" | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||