< prev index next >

src/java.base/share/classes/java/time/temporal/ChronoField.java

Print this page


   1 /*
   2  * Copyright (c) 2012, 2013, 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


 253      * This counts the minute within the day, from 0 to (24 * 60) - 1.
 254      * This field has the same meaning for all calendar systems.
 255      * <p>
 256      * When parsing this field it behaves equivalent to the following:
 257      * The value is validated in strict and smart mode but not in lenient mode.
 258      * The value is split to form {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields.
 259      */
 260     MINUTE_OF_DAY("MinuteOfDay", MINUTES, DAYS, ValueRange.of(0, (24 * 60) - 1)),
 261     /**
 262      * The hour-of-am-pm.
 263      * <p>
 264      * This counts the hour within the AM/PM, from 0 to 11.
 265      * This is the hour that would be observed on a standard 12-hour digital clock.
 266      * This field has the same meaning for all calendar systems.
 267      * <p>
 268      * When parsing this field it behaves equivalent to the following:
 269      * The value is validated from 0 to 11 in strict and smart mode.
 270      * In lenient mode the value is not validated. It is combined with
 271      * {@code AMPM_OF_DAY} to form {@code HOUR_OF_DAY} by multiplying
 272      * the {AMPM_OF_DAY} value by 12.


 273      */
 274     HOUR_OF_AMPM("HourOfAmPm", HOURS, HALF_DAYS, ValueRange.of(0, 11)),
 275     /**
 276      * The clock-hour-of-am-pm.
 277      * <p>
 278      * This counts the hour within the AM/PM, from 1 to 12.
 279      * This is the hour that would be observed on a standard 12-hour analog wall clock.
 280      * This field has the same meaning for all calendar systems.
 281      * <p>
 282      * When parsing this field it behaves equivalent to the following:
 283      * The value is validated from 1 to 12 in strict mode and from
 284      * 0 to 12 in smart mode. In lenient mode the value is not validated.
 285      * The field is converted to an {@code HOUR_OF_AMPM} with the same value,
 286      * unless the value is 12, in which case it is converted to 0.


 287      */
 288     CLOCK_HOUR_OF_AMPM("ClockHourOfAmPm", HOURS, HALF_DAYS, ValueRange.of(1, 12)),
 289     /**
 290      * The hour-of-day.
 291      * <p>
 292      * This counts the hour within the day, from 0 to 23.
 293      * This is the hour that would be observed on a standard 24-hour digital clock.
 294      * This field has the same meaning for all calendar systems.
 295      * <p>
 296      * When parsing this field it behaves equivalent to the following:
 297      * The value is validated in strict and smart mode but not in lenient mode.
 298      * The field is combined with {@code MINUTE_OF_HOUR}, {@code SECOND_OF_MINUTE} and
 299      * {@code NANO_OF_SECOND} to produce a {@code LocalTime}.
 300      * In lenient mode, any excess days are added to the parsed date, or
 301      * made available via {@link java.time.format.DateTimeFormatter#parsedExcessDays()}.


 302      */
 303     HOUR_OF_DAY("HourOfDay", HOURS, DAYS, ValueRange.of(0, 23), "hour"),
 304     /**
 305      * The clock-hour-of-day.
 306      * <p>
 307      * This counts the hour within the AM/PM, from 1 to 24.
 308      * This is the hour that would be observed on a 24-hour analog wall clock.
 309      * This field has the same meaning for all calendar systems.
 310      * <p>
 311      * When parsing this field it behaves equivalent to the following:
 312      * The value is validated from 1 to 24 in strict mode and from
 313      * 0 to 24 in smart mode. In lenient mode the value is not validated.
 314      * The field is converted to an {@code HOUR_OF_DAY} with the same value,
 315      * unless the value is 24, in which case it is converted to 0.


 316      */
 317     CLOCK_HOUR_OF_DAY("ClockHourOfDay", HOURS, DAYS, ValueRange.of(1, 24)),
 318     /**
 319      * The am-pm-of-day.
 320      * <p>
 321      * This counts the AM/PM within the day, from 0 (AM) to 1 (PM).
 322      * This field has the same meaning for all calendar systems.
 323      * <p>
 324      * When parsing this field it behaves equivalent to the following:
 325      * The value is validated from 0 to 1 in strict and smart mode.
 326      * In lenient mode the value is not validated. It is combined with
 327      * {@code HOUR_OF_AMPM} to form {@code HOUR_OF_DAY} by multiplying
 328      * the {AMPM_OF_DAY} value by 12.
 329      */
 330     AMPM_OF_DAY("AmPmOfDay", HALF_DAYS, DAYS, ValueRange.of(0, 1), "dayperiod"),
 331     /**
 332      * The day-of-week, such as Tuesday.
 333      * <p>
 334      * This represents the standard concept of the day of the week.
 335      * In the default ISO calendar system, this has values from Monday (1) to Sunday (7).


   1 /*
   2  * Copyright (c) 2012, 2016, 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


 253      * This counts the minute within the day, from 0 to (24 * 60) - 1.
 254      * This field has the same meaning for all calendar systems.
 255      * <p>
 256      * When parsing this field it behaves equivalent to the following:
 257      * The value is validated in strict and smart mode but not in lenient mode.
 258      * The value is split to form {@code MINUTE_OF_HOUR} and {@code HOUR_OF_DAY} fields.
 259      */
 260     MINUTE_OF_DAY("MinuteOfDay", MINUTES, DAYS, ValueRange.of(0, (24 * 60) - 1)),
 261     /**
 262      * The hour-of-am-pm.
 263      * <p>
 264      * This counts the hour within the AM/PM, from 0 to 11.
 265      * This is the hour that would be observed on a standard 12-hour digital clock.
 266      * This field has the same meaning for all calendar systems.
 267      * <p>
 268      * When parsing this field it behaves equivalent to the following:
 269      * The value is validated from 0 to 11 in strict and smart mode.
 270      * In lenient mode the value is not validated. It is combined with
 271      * {@code AMPM_OF_DAY} to form {@code HOUR_OF_DAY} by multiplying
 272      * the {AMPM_OF_DAY} value by 12.
 273      * <p>
 274      * See {@link #CLOCK_HOUR_OF_AMPM} for the related field that counts hours from 1 to 12.
 275      */
 276     HOUR_OF_AMPM("HourOfAmPm", HOURS, HALF_DAYS, ValueRange.of(0, 11)),
 277     /**
 278      * The clock-hour-of-am-pm.
 279      * <p>
 280      * This counts the hour within the AM/PM, from 1 to 12.
 281      * This is the hour that would be observed on a standard 12-hour analog wall clock.
 282      * This field has the same meaning for all calendar systems.
 283      * <p>
 284      * When parsing this field it behaves equivalent to the following:
 285      * The value is validated from 1 to 12 in strict mode and from
 286      * 0 to 12 in smart mode. In lenient mode the value is not validated.
 287      * The field is converted to an {@code HOUR_OF_AMPM} with the same value,
 288      * unless the value is 12, in which case it is converted to 0.
 289      * <p>
 290      * See {@link #HOUR_OF_AMPM} for the related field that counts hours from 0 to 11.
 291      */
 292     CLOCK_HOUR_OF_AMPM("ClockHourOfAmPm", HOURS, HALF_DAYS, ValueRange.of(1, 12)),
 293     /**
 294      * The hour-of-day.
 295      * <p>
 296      * This counts the hour within the day, from 0 to 23.
 297      * This is the hour that would be observed on a standard 24-hour digital clock.
 298      * This field has the same meaning for all calendar systems.
 299      * <p>
 300      * When parsing this field it behaves equivalent to the following:
 301      * The value is validated in strict and smart mode but not in lenient mode.
 302      * The field is combined with {@code MINUTE_OF_HOUR}, {@code SECOND_OF_MINUTE} and
 303      * {@code NANO_OF_SECOND} to produce a {@code LocalTime}.
 304      * In lenient mode, any excess days are added to the parsed date, or
 305      * made available via {@link java.time.format.DateTimeFormatter#parsedExcessDays()}.
 306      * <p>
 307      * See {@link #CLOCK_HOUR_OF_DAY} for the related field that counts hours from 1 to 24.
 308      */
 309     HOUR_OF_DAY("HourOfDay", HOURS, DAYS, ValueRange.of(0, 23), "hour"),
 310     /**
 311      * The clock-hour-of-day.
 312      * <p>
 313      * This counts the hour within the day, from 1 to 24.
 314      * This is the hour that would be observed on a 24-hour analog wall clock.
 315      * This field has the same meaning for all calendar systems.
 316      * <p>
 317      * When parsing this field it behaves equivalent to the following:
 318      * The value is validated from 1 to 24 in strict mode and from
 319      * 0 to 24 in smart mode. In lenient mode the value is not validated.
 320      * The field is converted to an {@code HOUR_OF_DAY} with the same value,
 321      * unless the value is 24, in which case it is converted to 0.
 322      * <p>
 323      * See {@link #HOUR_OF_DAY} for the related field that counts hours from 0 to 23.
 324      */
 325     CLOCK_HOUR_OF_DAY("ClockHourOfDay", HOURS, DAYS, ValueRange.of(1, 24)),
 326     /**
 327      * The am-pm-of-day.
 328      * <p>
 329      * This counts the AM/PM within the day, from 0 (AM) to 1 (PM).
 330      * This field has the same meaning for all calendar systems.
 331      * <p>
 332      * When parsing this field it behaves equivalent to the following:
 333      * The value is validated from 0 to 1 in strict and smart mode.
 334      * In lenient mode the value is not validated. It is combined with
 335      * {@code HOUR_OF_AMPM} to form {@code HOUR_OF_DAY} by multiplying
 336      * the {AMPM_OF_DAY} value by 12.
 337      */
 338     AMPM_OF_DAY("AmPmOfDay", HALF_DAYS, DAYS, ValueRange.of(0, 1), "dayperiod"),
 339     /**
 340      * The day-of-week, such as Tuesday.
 341      * <p>
 342      * This represents the standard concept of the day of the week.
 343      * In the default ISO calendar system, this has values from Monday (1) to Sunday (7).


< prev index next >