< prev index next >

src/java.base/share/classes/java/time/temporal/JulianFields.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


 100      * This is an integer-based version of the Julian Day Number.
 101      * Julian Day is a well-known system that represents the count of whole days since day 0,
 102      * which is defined to be January 1, 4713 BCE in the Julian calendar, and -4713-11-24 Gregorian.
 103      * The field  has "JulianDay" as 'name', and 'DAYS' as 'baseUnit'.
 104      * The field always refers to the local date-time, ignoring the offset or zone.
 105      * <p>
 106      * For date-times, 'JULIAN_DAY.getFrom()' assumes the same value from
 107      * midnight until just before the next midnight.
 108      * When 'JULIAN_DAY.adjustInto()' is applied to a date-time, the time of day portion remains unaltered.
 109      * 'JULIAN_DAY.adjustInto()' and 'JULIAN_DAY.getFrom()' only apply to {@code Temporal} objects that
 110      * can be converted into {@link ChronoField#EPOCH_DAY}.
 111      * An {@link UnsupportedTemporalTypeException} is thrown for any other type of object.
 112      * <p>
 113      * In the resolving phase of parsing, a date can be created from a Julian Day field.
 114      * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode}
 115      * the Julian Day value is validated against the range of valid values.
 116      * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs.
 117      *
 118      * <h3>Astronomical and Scientific Notes</h3>
 119      * The standard astronomical definition uses a fraction to indicate the time-of-day,
 120      * thus 3.25 would represent the time 18:00, since days start at midday.






 121      * This implementation uses an integer and days starting at midnight.
 122      * The integer value for the Julian Day Number is the astronomical Julian Day value at midday
 123      * of the date in question.
 124      * This amounts to the astronomical Julian Day, rounded to an integer {@code JDN = floor(JD + 0.5)}.
 125      *
 126      * <pre>
 127      *  | ISO date          |  Julian Day Number | Astronomical Julian Day |
 128      *  | 1970-01-01T00:00  |         2,440,588  |         2,440,587.5     |
 129      *  | 1970-01-01T06:00  |         2,440,588  |         2,440,587.75    |
 130      *  | 1970-01-01T12:00  |         2,440,588  |         2,440,588.0     |
 131      *  | 1970-01-01T18:00  |         2,440,588  |         2,440,588.25    |
 132      *  | 1970-01-02T00:00  |         2,440,589  |         2,440,588.5     |
 133      *  | 1970-01-02T06:00  |         2,440,589  |         2,440,588.75    |
 134      *  | 1970-01-02T12:00  |         2,440,589  |         2,440,589.0     |
 135      * </pre>
 136      * <p>
 137      * Julian Days are sometimes taken to imply Universal Time or UTC, but this
 138      * implementation always uses the Julian Day number for the local date,
 139      * regardless of the offset or time-zone.
 140      */


   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


 100      * This is an integer-based version of the Julian Day Number.
 101      * Julian Day is a well-known system that represents the count of whole days since day 0,
 102      * which is defined to be January 1, 4713 BCE in the Julian calendar, and -4713-11-24 Gregorian.
 103      * The field  has "JulianDay" as 'name', and 'DAYS' as 'baseUnit'.
 104      * The field always refers to the local date-time, ignoring the offset or zone.
 105      * <p>
 106      * For date-times, 'JULIAN_DAY.getFrom()' assumes the same value from
 107      * midnight until just before the next midnight.
 108      * When 'JULIAN_DAY.adjustInto()' is applied to a date-time, the time of day portion remains unaltered.
 109      * 'JULIAN_DAY.adjustInto()' and 'JULIAN_DAY.getFrom()' only apply to {@code Temporal} objects that
 110      * can be converted into {@link ChronoField#EPOCH_DAY}.
 111      * An {@link UnsupportedTemporalTypeException} is thrown for any other type of object.
 112      * <p>
 113      * In the resolving phase of parsing, a date can be created from a Julian Day field.
 114      * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode}
 115      * the Julian Day value is validated against the range of valid values.
 116      * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs.
 117      *
 118      * <h3>Astronomical and Scientific Notes</h3>
 119      * The standard astronomical definition uses a fraction to indicate the time-of-day,
 120      * where each day is counted from midday to midday. For example,
 121      * a fraction of 0 represents midday, a fraction of 0.25
 122      * represents 18:00, a fraction of 0.5 represents midnight and a fraction
 123      * of 0.75 represents 06:00.
 124      * <p>
 125      * By contrast, this implementation has no fractional part, and counts
 126      * days from midnight to midnight.
 127      * This implementation uses an integer and days starting at midnight.
 128      * The integer value for the Julian Day Number is the astronomical Julian Day value at midday
 129      * of the date in question.
 130      * This amounts to the astronomical Julian Day, rounded to an integer {@code JDN = floor(JD + 0.5)}.
 131      *
 132      * <pre>
 133      *  | ISO date          |  Julian Day Number | Astronomical Julian Day |
 134      *  | 1970-01-01T00:00  |         2,440,588  |         2,440,587.5     |
 135      *  | 1970-01-01T06:00  |         2,440,588  |         2,440,587.75    |
 136      *  | 1970-01-01T12:00  |         2,440,588  |         2,440,588.0     |
 137      *  | 1970-01-01T18:00  |         2,440,588  |         2,440,588.25    |
 138      *  | 1970-01-02T00:00  |         2,440,589  |         2,440,588.5     |
 139      *  | 1970-01-02T06:00  |         2,440,589  |         2,440,588.75    |
 140      *  | 1970-01-02T12:00  |         2,440,589  |         2,440,589.0     |
 141      * </pre>
 142      * <p>
 143      * Julian Days are sometimes taken to imply Universal Time or UTC, but this
 144      * implementation always uses the Julian Day number for the local date,
 145      * regardless of the offset or time-zone.
 146      */


< prev index next >