64 import static java.time.temporal.ChronoField.EPOCH_DAY; |
64 import static java.time.temporal.ChronoField.EPOCH_DAY; |
65 import static java.time.temporal.ChronoUnit.DAYS; |
65 import static java.time.temporal.ChronoUnit.DAYS; |
66 import static java.time.temporal.ChronoUnit.FOREVER; |
66 import static java.time.temporal.ChronoUnit.FOREVER; |
67 |
67 |
68 import java.time.DateTimeException; |
68 import java.time.DateTimeException; |
69 import java.time.ZoneId; |
|
70 import java.time.chrono.ChronoLocalDate; |
69 import java.time.chrono.ChronoLocalDate; |
71 import java.time.chrono.Chronology; |
70 import java.time.chrono.Chronology; |
72 import java.time.format.ResolverStyle; |
71 import java.time.format.ResolverStyle; |
73 import java.util.Collections; |
|
74 import java.util.Map; |
72 import java.util.Map; |
75 |
73 |
76 /** |
74 /** |
77 * A set of date fields that provide access to Julian Days. |
75 * A set of date fields that provide access to Julian Days. |
78 * <p> |
76 * <p> |
114 * <p> |
112 * <p> |
115 * In the resolving phase of parsing, a date can be created from a Julian Day field. |
113 * In the resolving phase of parsing, a date can be created from a Julian Day field. |
116 * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode} |
114 * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode} |
117 * the Julian Day value is validated against the range of valid values. |
115 * the Julian Day value is validated against the range of valid values. |
118 * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs. |
116 * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs. |
119 * <p> |
117 * |
120 * <h3>Astronomical and Scientific Notes</h3> |
118 * <h3>Astronomical and Scientific Notes</h3> |
121 * The standard astronomical definition uses a fraction to indicate the time-of-day, |
119 * The standard astronomical definition uses a fraction to indicate the time-of-day, |
122 * thus 3.25 would represent the time 18:00, since days start at midday. |
120 * thus 3.25 would represent the time 18:00, since days start at midday. |
123 * This implementation uses an integer and days starting at midnight. |
121 * This implementation uses an integer and days starting at midnight. |
124 * The integer value for the Julian Day Number is the astronomical Julian Day value at midday |
122 * The integer value for the Julian Day Number is the astronomical Julian Day value at midday |
125 * of the date in question. |
123 * of the date in question. |
126 * This amounts to the astronomical Julian Day, rounded to an integer {@code JDN = floor(JD + 0.5)}. |
124 * This amounts to the astronomical Julian Day, rounded to an integer {@code JDN = floor(JD + 0.5)}. |
127 * <p> |
125 * |
128 * <pre> |
126 * <pre> |
129 * | ISO date | Julian Day Number | Astronomical Julian Day | |
127 * | ISO date | Julian Day Number | Astronomical Julian Day | |
130 * | 1970-01-01T00:00 | 2,440,588 | 2,440,587.5 | |
128 * | 1970-01-01T00:00 | 2,440,588 | 2,440,587.5 | |
131 * | 1970-01-01T06:00 | 2,440,588 | 2,440,587.75 | |
129 * | 1970-01-01T06:00 | 2,440,588 | 2,440,587.75 | |
132 * | 1970-01-01T12:00 | 2,440,588 | 2,440,588.0 | |
130 * | 1970-01-01T12:00 | 2,440,588 | 2,440,588.0 | |
162 * <p> |
160 * <p> |
163 * In the resolving phase of parsing, a date can be created from a Modified Julian Day field. |
161 * In the resolving phase of parsing, a date can be created from a Modified Julian Day field. |
164 * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode} |
162 * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode} |
165 * the Modified Julian Day value is validated against the range of valid values. |
163 * the Modified Julian Day value is validated against the range of valid values. |
166 * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs. |
164 * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs. |
167 * <p> |
165 * |
168 * <h3>Astronomical and Scientific Notes</h3> |
166 * <h3>Astronomical and Scientific Notes</h3> |
169 * <pre> |
167 * <pre> |
170 * | ISO date | Modified Julian Day | Decimal MJD | |
168 * | ISO date | Modified Julian Day | Decimal MJD | |
171 * | 1970-01-01T00:00 | 40,587 | 40,587.0 | |
169 * | 1970-01-01T00:00 | 40,587 | 40,587.0 | |
172 * | 1970-01-01T06:00 | 40,587 | 40,587.25 | |
170 * | 1970-01-01T06:00 | 40,587 | 40,587.25 | |
174 * | 1970-01-01T18:00 | 40,587 | 40,587.75 | |
172 * | 1970-01-01T18:00 | 40,587 | 40,587.75 | |
175 * | 1970-01-02T00:00 | 40,588 | 40,588.0 | |
173 * | 1970-01-02T00:00 | 40,588 | 40,588.0 | |
176 * | 1970-01-02T06:00 | 40,588 | 40,588.25 | |
174 * | 1970-01-02T06:00 | 40,588 | 40,588.25 | |
177 * | 1970-01-02T12:00 | 40,588 | 40,588.5 | |
175 * | 1970-01-02T12:00 | 40,588 | 40,588.5 | |
178 * </pre> |
176 * </pre> |
179 * <p> |
177 * |
180 * Modified Julian Days are sometimes taken to imply Universal Time or UTC, but this |
178 * Modified Julian Days are sometimes taken to imply Universal Time or UTC, but this |
181 * implementation always uses the Modified Julian Day for the local date, |
179 * implementation always uses the Modified Julian Day for the local date, |
182 * regardless of the offset or time-zone. |
180 * regardless of the offset or time-zone. |
183 */ |
181 */ |
184 public static final TemporalField MODIFIED_JULIAN_DAY = Field.MODIFIED_JULIAN_DAY; |
182 public static final TemporalField MODIFIED_JULIAN_DAY = Field.MODIFIED_JULIAN_DAY; |