104 * often viewed as year-month-day-hour-minute-second. Other date and time fields,
105 * such as day-of-year, day-of-week and week-of-year, can also be accessed.
106 * Time is represented to nanosecond precision.
107 * For example, the value "2nd October 2007 at 13:45.30.123456789" can be
108 * stored in a {@code LocalDateTime}.
109 * <p>
110 * This class does not store or represent a time-zone.
111 * Instead, it is a description of the date, as used for birthdays, combined with
112 * the local time as seen on a wall clock.
113 * It cannot represent an instant on the time-line without additional information
114 * such as an offset or time-zone.
115 * <p>
116 * The ISO-8601 calendar system is the modern civil calendar system used today
117 * in most of the world. It is equivalent to the proleptic Gregorian calendar
118 * system, in which today's rules for leap years are applied for all time.
119 * For most applications written today, the ISO-8601 rules are entirely suitable.
120 * However, any application that makes use of historical dates, and requires them
121 * to be accurate will find the ISO-8601 approach unsuitable.
122 * <p>
123 * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
124 * class; programmers should treat instances that are
125 * {@linkplain #equals(Object) equal} as interchangeable and should not
126 * use instances for synchronization, or unpredictable behavior may
127 * occur. For example, in a future release, synchronization may fail.
128 * The {@code equals} method should be used for comparisons.
129 *
130 * @implSpec
131 * This class is immutable and thread-safe.
132 *
133 * @since 1.8
134 */
135 @jdk.internal.ValueBased
136 public final class LocalDateTime
137 implements Temporal, TemporalAdjuster, ChronoLocalDateTime<LocalDate>, Serializable {
138
139 /**
140 * The minimum supported {@code LocalDateTime}, '-999999999-01-01T00:00:00'.
141 * This is the local date-time of midnight at the start of the minimum date.
142 * This combines {@link LocalDate#MIN} and {@link LocalTime#MIN}.
143 * This could be used by an application as a "far past" date-time.
144 */
145 public static final LocalDateTime MIN = LocalDateTime.of(LocalDate.MIN, LocalTime.MIN);
146 /**
147 * The maximum supported {@code LocalDateTime}, '+999999999-12-31T23:59:59.999999999'.
148 * This is the local date-time just before midnight at the end of the maximum date.
149 * This combines {@link LocalDate#MAX} and {@link LocalTime#MAX}.
150 * This could be used by an application as a "far future" date-time.
151 */
152 public static final LocalDateTime MAX = LocalDateTime.of(LocalDate.MAX, LocalTime.MAX);
153
154 /**
155 * Serialization version.
|
104 * often viewed as year-month-day-hour-minute-second. Other date and time fields,
105 * such as day-of-year, day-of-week and week-of-year, can also be accessed.
106 * Time is represented to nanosecond precision.
107 * For example, the value "2nd October 2007 at 13:45.30.123456789" can be
108 * stored in a {@code LocalDateTime}.
109 * <p>
110 * This class does not store or represent a time-zone.
111 * Instead, it is a description of the date, as used for birthdays, combined with
112 * the local time as seen on a wall clock.
113 * It cannot represent an instant on the time-line without additional information
114 * such as an offset or time-zone.
115 * <p>
116 * The ISO-8601 calendar system is the modern civil calendar system used today
117 * in most of the world. It is equivalent to the proleptic Gregorian calendar
118 * system, in which today's rules for leap years are applied for all time.
119 * For most applications written today, the ISO-8601 rules are entirely suitable.
120 * However, any application that makes use of historical dates, and requires them
121 * to be accurate will find the ISO-8601 approach unsuitable.
122 * <p>
123 * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
124 * class; programmers should treat instances that are {@linkplain #equals(Object) equal}
125 * as interchangeable and should not use instances for synchronization, mutexes, or
126 * with {@linkplain java.lang.ref.Reference object references}.
127 *
128 * <div class="preview-block">
129 * <div class="preview-comment">
130 * When preview features are enabled, {@code LocalDateTime} is a {@linkplain Class#isValue value class}.
131 * Use of value class instances for synchronization, mutexes, or with
132 * {@linkplain java.lang.ref.Reference object references} result in
133 * {@link IdentityException}.
134 * </div>
135 * </div>
136 *
137 * @implSpec
138 * This class is immutable and thread-safe.
139 *
140 * @since 1.8
141 */
142 @jdk.internal.ValueBased
143 @jdk.internal.MigratedValueClass
144 public final class LocalDateTime
145 implements Temporal, TemporalAdjuster, ChronoLocalDateTime<LocalDate>, Serializable {
146
147 /**
148 * The minimum supported {@code LocalDateTime}, '-999999999-01-01T00:00:00'.
149 * This is the local date-time of midnight at the start of the minimum date.
150 * This combines {@link LocalDate#MIN} and {@link LocalTime#MIN}.
151 * This could be used by an application as a "far past" date-time.
152 */
153 public static final LocalDateTime MIN = LocalDateTime.of(LocalDate.MIN, LocalTime.MIN);
154 /**
155 * The maximum supported {@code LocalDateTime}, '+999999999-12-31T23:59:59.999999999'.
156 * This is the local date-time just before midnight at the end of the maximum date.
157 * This combines {@link LocalDate#MAX} and {@link LocalTime#MAX}.
158 * This could be used by an application as a "far future" date-time.
159 */
160 public static final LocalDateTime MAX = LocalDateTime.of(LocalDate.MAX, LocalTime.MAX);
161
162 /**
163 * Serialization version.
|