< prev index next >

src/java.base/share/classes/java/time/LocalDate.java

Print this page

 108  * such as {@code 2007-12-03}.
 109  * <p>
 110  * {@code LocalDate} is an immutable date-time object that represents a date,
 111  * often viewed as year-month-day. Other date fields, such as day-of-year,
 112  * day-of-week and week-of-year, can also be accessed.
 113  * For example, the value "2nd October 2007" can be stored in a {@code LocalDate}.
 114  * <p>
 115  * This class does not store or represent a time or time-zone.
 116  * Instead, it is a description of the date, as used for birthdays.
 117  * It cannot represent an instant on the time-line without additional information
 118  * such as an offset or time-zone.
 119  * <p>
 120  * The ISO-8601 calendar system is the modern civil calendar system used today
 121  * in most of the world. It is equivalent to the proleptic Gregorian calendar
 122  * system, in which today's rules for leap years are applied for all time.
 123  * For most applications written today, the ISO-8601 rules are entirely suitable.
 124  * However, any application that makes use of historical dates, and requires them
 125  * to be accurate will find the ISO-8601 approach unsuitable.
 126  * <p>
 127  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
 128  * class; programmers should treat instances that are
 129  * {@linkplain #equals(Object) equal} as interchangeable and should not
 130  * use instances for synchronization, or unpredictable behavior may
 131  * occur. For example, in a future release, synchronization may fail.
 132  * The {@code equals} method should be used for comparisons.







 133  *
 134  * @implSpec
 135  * This class is immutable and thread-safe.
 136  *
 137  * @since 1.8
 138  */
 139 @jdk.internal.ValueBased

 140 public final class LocalDate
 141         implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable {
 142 
 143     /**
 144      * The minimum supported {@code LocalDate}, '-999999999-01-01'.
 145      * This could be used by an application as a "far past" date.
 146      */
 147     public static final LocalDate MIN = LocalDate.of(Year.MIN_VALUE, 1, 1);
 148     /**
 149      * The maximum supported {@code LocalDate}, '+999999999-12-31'.
 150      * This could be used by an application as a "far future" date.
 151      */
 152     public static final LocalDate MAX = LocalDate.of(Year.MAX_VALUE, 12, 31);
 153     /**
 154      * The epoch year {@code LocalDate}, '1970-01-01'.
 155      *
 156      * @since 9
 157      */
 158     public static final LocalDate EPOCH = LocalDate.of(1970, 1, 1);
 159 

 108  * such as {@code 2007-12-03}.
 109  * <p>
 110  * {@code LocalDate} is an immutable date-time object that represents a date,
 111  * often viewed as year-month-day. Other date fields, such as day-of-year,
 112  * day-of-week and week-of-year, can also be accessed.
 113  * For example, the value "2nd October 2007" can be stored in a {@code LocalDate}.
 114  * <p>
 115  * This class does not store or represent a time or time-zone.
 116  * Instead, it is a description of the date, as used for birthdays.
 117  * It cannot represent an instant on the time-line without additional information
 118  * such as an offset or time-zone.
 119  * <p>
 120  * The ISO-8601 calendar system is the modern civil calendar system used today
 121  * in most of the world. It is equivalent to the proleptic Gregorian calendar
 122  * system, in which today's rules for leap years are applied for all time.
 123  * For most applications written today, the ISO-8601 rules are entirely suitable.
 124  * However, any application that makes use of historical dates, and requires them
 125  * to be accurate will find the ISO-8601 approach unsuitable.
 126  * <p>
 127  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
 128  * class; programmers should treat instances that are {@linkplain #equals(Object) equal}
 129  * as interchangeable and should not use instances for synchronization, mutexes, or
 130  * with {@linkplain java.lang.ref.Reference object references}.
 131  *
 132  * <div class="preview-block">
 133  *      <div class="preview-comment">
 134  *          When preview features are enabled, {@code LocalDate} is a {@linkplain Class#isValue value class}.
 135  *          Use of value class instances for synchronization, mutexes, or with
 136  *          {@linkplain java.lang.ref.Reference object references} result in
 137  *          {@link IdentityException}.
 138  *      </div>
 139  * </div>
 140  *
 141  * @implSpec
 142  * This class is immutable and thread-safe.
 143  *
 144  * @since 1.8
 145  */
 146 @jdk.internal.ValueBased
 147 @jdk.internal.MigratedValueClass
 148 public final class LocalDate
 149         implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable {
 150 
 151     /**
 152      * The minimum supported {@code LocalDate}, '-999999999-01-01'.
 153      * This could be used by an application as a "far past" date.
 154      */
 155     public static final LocalDate MIN = LocalDate.of(Year.MIN_VALUE, 1, 1);
 156     /**
 157      * The maximum supported {@code LocalDate}, '+999999999-12-31'.
 158      * This could be used by an application as a "far future" date.
 159      */
 160     public static final LocalDate MAX = LocalDate.of(Year.MAX_VALUE, 12, 31);
 161     /**
 162      * The epoch year {@code LocalDate}, '1970-01-01'.
 163      *
 164      * @since 9
 165      */
 166     public static final LocalDate EPOCH = LocalDate.of(1970, 1, 1);
 167 
< prev index next >