< prev index next >

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

Print this page




  97  * A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system,
  98  * such as {@code 2007-12-03T10:15:30+01:00}.
  99  * <p>
 100  * {@code OffsetDateTime} is an immutable representation of a date-time with an offset.
 101  * This class stores all date and time fields, to a precision of nanoseconds,
 102  * as well as the offset from UTC/Greenwich. For example, the value
 103  * "2nd October 2007 at 13:45:30.123456789 +02:00" can be stored in an {@code OffsetDateTime}.
 104  * <p>
 105  * {@code OffsetDateTime}, {@link java.time.ZonedDateTime} and {@link java.time.Instant} all store an instant
 106  * on the time-line to nanosecond precision.
 107  * {@code Instant} is the simplest, simply representing the instant.
 108  * {@code OffsetDateTime} adds to the instant the offset from UTC/Greenwich, which allows
 109  * the local date-time to be obtained.
 110  * {@code ZonedDateTime} adds full time-zone rules.
 111  * <p>
 112  * It is intended that {@code ZonedDateTime} or {@code Instant} is used to model data
 113  * in simpler applications. This class may be used when modeling date-time concepts in
 114  * more detail, or when communicating to a database or in a network protocol.
 115  *
 116  * <p>
 117  * This is a <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>
 118  * class; use of identity-sensitive operations (including reference equality
 119  * ({@code ==}), identity hash code, or synchronization) on instances of
 120  * {@code OffsetDateTime} may have unpredictable results and should be avoided.
 121  * The {@code equals} method should be used for comparisons.
 122  *
 123  * @implSpec
 124  * This class is immutable and thread-safe.
 125  *
 126  * @since 1.8
 127  */
 128 public final class OffsetDateTime
 129         implements Temporal, TemporalAdjuster, Comparable<OffsetDateTime>, Serializable {
 130 
 131     /**
 132      * The minimum supported {@code OffsetDateTime}, '-999999999-01-01T00:00:00+18:00'.
 133      * This is the local date-time of midnight at the start of the minimum date
 134      * in the maximum offset (larger offsets are earlier on the time-line).
 135      * This combines {@link LocalDateTime#MIN} and {@link ZoneOffset#MAX}.
 136      * This could be used by an application as a "far past" date-time.
 137      */




  97  * A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system,
  98  * such as {@code 2007-12-03T10:15:30+01:00}.
  99  * <p>
 100  * {@code OffsetDateTime} is an immutable representation of a date-time with an offset.
 101  * This class stores all date and time fields, to a precision of nanoseconds,
 102  * as well as the offset from UTC/Greenwich. For example, the value
 103  * "2nd October 2007 at 13:45:30.123456789 +02:00" can be stored in an {@code OffsetDateTime}.
 104  * <p>
 105  * {@code OffsetDateTime}, {@link java.time.ZonedDateTime} and {@link java.time.Instant} all store an instant
 106  * on the time-line to nanosecond precision.
 107  * {@code Instant} is the simplest, simply representing the instant.
 108  * {@code OffsetDateTime} adds to the instant the offset from UTC/Greenwich, which allows
 109  * the local date-time to be obtained.
 110  * {@code ZonedDateTime} adds full time-zone rules.
 111  * <p>
 112  * It is intended that {@code ZonedDateTime} or {@code Instant} is used to model data
 113  * in simpler applications. This class may be used when modeling date-time concepts in
 114  * more detail, or when communicating to a database or in a network protocol.
 115  *
 116  * <p>
 117  * This is a <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>
 118  * class; use of identity-sensitive operations (including reference equality
 119  * ({@code ==}), identity hash code, or synchronization) on instances of
 120  * {@code OffsetDateTime} may have unpredictable results and should be avoided.
 121  * The {@code equals} method should be used for comparisons.
 122  *
 123  * @implSpec
 124  * This class is immutable and thread-safe.
 125  *
 126  * @since 1.8
 127  */
 128 public final class OffsetDateTime
 129         implements Temporal, TemporalAdjuster, Comparable<OffsetDateTime>, Serializable {
 130 
 131     /**
 132      * The minimum supported {@code OffsetDateTime}, '-999999999-01-01T00:00:00+18:00'.
 133      * This is the local date-time of midnight at the start of the minimum date
 134      * in the maximum offset (larger offsets are earlier on the time-line).
 135      * This combines {@link LocalDateTime#MIN} and {@link ZoneOffset#MAX}.
 136      * This could be used by an application as a "far past" date-time.
 137      */


< prev index next >