1 /*
2 * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
99 *
100 * <h2>Getting and Setting Calendar Field Values</h2>
101 *
102 * <p>The calendar field values can be set by calling the {@code set}
103 * methods. Any field values set in a {@code Calendar} will not be
104 * interpreted until it needs to calculate its time value (milliseconds from
105 * the Epoch) or values of the calendar fields. Calling the
106 * {@code get}, {@code getTimeInMillis}, {@code getTime},
107 * {@code add} and {@code roll} involves such calculation.
108 *
109 * <h3>Leniency</h3>
110 *
111 * <p>{@code Calendar} has two modes for interpreting the calendar
112 * fields, <em>lenient</em> and <em>non-lenient</em>. When a
113 * {@code Calendar} is in lenient mode, it accepts a wider range of
114 * calendar field values than it produces. When a {@code Calendar}
115 * recomputes calendar field values for return by {@code get()}, all of
116 * the calendar fields are normalized. For example, a lenient
117 * {@code GregorianCalendar} interprets {@code MONTH == JANUARY},
118 * {@code DAY_OF_MONTH == 32} as February 1.
119
120 * <p>When a {@code Calendar} is in non-lenient mode, it throws an
121 * exception if there is any inconsistency in its calendar fields. For
122 * example, a {@code GregorianCalendar} always produces
123 * {@code DAY_OF_MONTH} values between 1 and the length of the month. A
124 * non-lenient {@code GregorianCalendar} throws an exception upon
125 * calculating its time or calendar field values if any out-of-range field
126 * value has been set.
127 *
128 * <h3><a id="first_week">First Week</a></h3>
129 *
130 * {@code Calendar} defines a locale-specific seven day week using two
131 * parameters: the first day of the week and the minimal days in first week
132 * (from 1 to 7). These numbers are taken from the locale resource data or the
133 * locale itself when a {@code Calendar} is constructed. If the designated
134 * locale contains "fw" and/or "rg" <a href="./Locale.html#def_locale_extension">
135 * Unicode extensions</a>, the first day of the week will be obtained according to
136 * those extensions. If both "fw" and "rg" are specified, the value from the "fw"
137 * extension supersedes the implicit one from the "rg" extension.
138 * They may also be specified explicitly through the methods for setting their
139 * values.
|
1 /*
2 * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
99 *
100 * <h2>Getting and Setting Calendar Field Values</h2>
101 *
102 * <p>The calendar field values can be set by calling the {@code set}
103 * methods. Any field values set in a {@code Calendar} will not be
104 * interpreted until it needs to calculate its time value (milliseconds from
105 * the Epoch) or values of the calendar fields. Calling the
106 * {@code get}, {@code getTimeInMillis}, {@code getTime},
107 * {@code add} and {@code roll} involves such calculation.
108 *
109 * <h3>Leniency</h3>
110 *
111 * <p>{@code Calendar} has two modes for interpreting the calendar
112 * fields, <em>lenient</em> and <em>non-lenient</em>. When a
113 * {@code Calendar} is in lenient mode, it accepts a wider range of
114 * calendar field values than it produces. When a {@code Calendar}
115 * recomputes calendar field values for return by {@code get()}, all of
116 * the calendar fields are normalized. For example, a lenient
117 * {@code GregorianCalendar} interprets {@code MONTH == JANUARY},
118 * {@code DAY_OF_MONTH == 32} as February 1.
119 *
120 * <p>When a {@code Calendar} is in non-lenient mode, it throws an
121 * exception if there is any inconsistency in its calendar fields. For
122 * example, a {@code GregorianCalendar} always produces
123 * {@code DAY_OF_MONTH} values between 1 and the length of the month. A
124 * non-lenient {@code GregorianCalendar} throws an exception upon
125 * calculating its time or calendar field values if any out-of-range field
126 * value has been set.
127 *
128 * <h3><a id="first_week">First Week</a></h3>
129 *
130 * {@code Calendar} defines a locale-specific seven day week using two
131 * parameters: the first day of the week and the minimal days in first week
132 * (from 1 to 7). These numbers are taken from the locale resource data or the
133 * locale itself when a {@code Calendar} is constructed. If the designated
134 * locale contains "fw" and/or "rg" <a href="./Locale.html#def_locale_extension">
135 * Unicode extensions</a>, the first day of the week will be obtained according to
136 * those extensions. If both "fw" and "rg" are specified, the value from the "fw"
137 * extension supersedes the implicit one from the "rg" extension.
138 * They may also be specified explicitly through the methods for setting their
139 * values.
|