< prev index next >

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

Print this page

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







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

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

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