Home | History | Annotate | Download | only in util

Lines Matching defs:Calendar

30  * {@code Calendar} is an abstract base class for converting between a
38 * Subclasses of {@code Calendar} interpret a {@code Date}
39 * according to the rules of a specific calendar system.
42 * Like other locale-sensitive classes, {@code Calendar} provides a class
44 * this class for general use. {@code Calendar}'s {@code getInstance} method
45 * returns a calendar whose locale is based on system settings and whose time fields
48 * <pre>Calendar rightNow = Calendar.getInstance()</pre>
53 * A {@code Calendar} object can produce all the time field values needed
54 * to implement the date-time formatting for a particular language and calendar
56 * {@code Calendar} defines the range of values returned by certain
64 * When a {@code Calendar} is <em>lenient</em>, it accepts a wider
75 * {@code Calendar} defines a locale-specific seven day week using two
78 * {@code Calendar} is constructed. They may also be specified explicitly
83 * {@code WEEK_OF_YEAR} fields, {@code Calendar} must determine
90 * be different. For example, a specific {@code Calendar} subclass may
102 * <strong>Insufficient information.</strong> The calendar will use default
103 * information to specify the missing fields. This may vary by calendar; for the
104 * Gregorian calendar, the default for a field is the same as that of the start
108 * <strong>Inconsistent information.</strong> If fields conflict, the calendar
110 * determining the day, the calendar will look for one of the following
150 * The date or time format strings are not part of the definition of a calendar,
158 * {@code Calendar} fields can be changed using three methods:
165 * {@code f} is changed immediately, the calendar's milliseconds is not
171 * the calendar system. In addition, {@code get(f)} will not necessarily
173 * specifics are determined by the concrete calendar class.
177 * set to August 31, 1999. Calling <code>set(Calendar.MONTH,
178 * Calendar.SEPTEMBER)</code>
179 * sets the calendar to September 31, 1999. This is a temporary internal
181 * then called. However, a call to {@code set(Calendar.DAY_OF_MONTH, 30)}
182 * before the call to {@code getTime()} sets the calendar to September
207 * smaller fields that are not expected to be invariant. The calendar system
213 * immediate recomputation of the calendar's milliseconds and all fields.
217 * set to August 31, 1999. Calling {@code add(Calendar.MONTH, 13)} sets
218 * the calendar to September 30, 2000. <strong>Add rule 1</strong> sets the
241 * set to August 31, 1999. Calling <code>roll(Calendar.MONTH,
243 * the calendar to April 30, <strong>1999</strong>. Add rule 1 sets the
252 * {@code roll(Calendar.WEEK_OF_MONTH, -1)} sets the calendar to Tuesday
253 * June 1, 1999, whereas calling {@code add(Calendar.WEEK_OF_MONTH, -1)}
254 * sets the calendar to Sunday May 30, 1999. This is because the roll rule
279 * <tt>Calendar</tt>. It is quite possible for <tt>Calendar</tt> subclasses
289 public abstract class Calendar implements Serializable, Cloneable, Comparable<Calendar> {
462 * era, e.g., AD or BC in the Julian calendar. This is a calendar-specific
472 * year. This is a calendar-specific value; see subclass documentation.
478 * month. This is a calendar-specific value. The first month of the year is
649 * by this calendar, you will need to add the {@code ZONE_OFFSET} and
661 * by this calendar, you will need to add the {@code ZONE_OFFSET} and
667 * This is the total number of fields in this calendar.
711 * Constructs a {@code Calendar} instance using the default {@code TimeZone} and {@code Locale}.
713 protected Calendar() {
717 Calendar(TimeZone timezone) {
726 * Constructs a {@code Calendar} instance using the given {@code TimeZone} and {@code Locale}.
728 protected Calendar(TimeZone timezone, Locale locale) {
738 * Adds the given amount to a {@code Calendar} field.
741 * the {@code Calendar} field to modify.
751 * Returns whether the {@code Date} represented by this {@code Calendar} instance is after the {@code Date}
753 * zones of the {@code Calendar}.
755 * @param calendar
756 * the {@code Calendar} instance to compare.
757 * @return {@code true} when this Calendar is after calendar, {@code false} otherwise.
762 public boolean after(Object calendar) {
763 if (!(calendar instanceof Calendar)) {
766 return getTimeInMillis() > ((Calendar) calendar).getTimeInMillis();
770 * Returns whether the {@code Date} represented by this {@code Calendar} instance is before the
772 * time zones of the {@code Calendar}.
774 * @param calendar
775 * the {@code Calendar} instance to compare.
776 * @return {@code true} when this Calendar is before calendar, {@code false} otherwise.
781 public boolean before(Object calendar) {
782 if (!(calendar instanceof Calendar)) {
785 return getTimeInMillis() < ((Calendar) calendar).getTimeInMillis();
813 * Returns a shallow copy of this {@code Calendar} with the same properties.
818 Calendar clone = (Calendar) super.clone();
848 * Computes the {@code Calendar} fields from {@code time}.
853 * Computes {@code time} from the Calendar fields.
862 * Compares the given object to this {@code Calendar} and returns whether they are
863 * equal. The object must be an instance of {@code Calendar} and have the same
866 * @return {@code true} if the given object is equal to this {@code Calendar}, {@code false}
874 if (!(object instanceof Calendar)) {
877 Calendar cal = (Calendar) object;
945 * Returns an array of locales for which custom {@code Calendar} instances
954 * Returns the first day of the week for this {@code Calendar}.
968 * Constructs a new instance of the {@code Calendar} subclass appropriate for the
971 public static synchronized Calendar getInstance() {
976 * Constructs a new instance of the {@code Calendar} subclass appropriate for the
979 public static synchronized Calendar getInstance(Locale locale) {
984 * Constructs a new instance of the {@code Calendar} subclass appropriate for the
987 public static synchronized Calendar getInstance(TimeZone timezone) {
992 * Constructs a new instance of the {@code Calendar} subclass appropriate for the
995 public static synchronized Calendar getInstance(TimeZone timezone, Locale locale) {
1026 * Returns the time of this {@code Calendar} as a {@code Date} object.
1037 * Returns the time represented by this {@code Calendar}, recomputing the time from its
1053 * Returns the time zone used by this {@code Calendar}.
1073 * Tests whether this {@code Calendar} accepts field values which are outside the valid
1169 * Sets the first day of the week for this {@code Calendar}.
1177 * Sets whether this {@code Calendar} accepts field values which are outside the valid
1192 * Sets the time of this {@code Calendar}.
1199 * Sets the time of this {@code Calendar} to the given Unix time. See {@link Date} for more
1212 * Sets the {@code TimeZone} used by this Calendar.
1220 * Returns a string representation of this {@code Calendar}, showing which fields are set.
1246 * Compares the time represented by this {@code Calendar} to that represented by the given
1247 * {@code Calendar}.
1249 * @return 0 if the times of the two {@code Calendar}s are equal, -1 if the time of
1250 * this {@code Calendar} is before the other one, 1 if the time of this
1251 * {@code Calendar} is after the other one.
1258 public int compareTo(Calendar anotherCalendar) {
1399 firstDayOfWeek = readFields.get("firstDayOfWeek", Calendar.SUNDAY);