Is valid for the specified zone, thus the local date-time may be adjusted. Time-zone rules, such as daylight savings, mean that not every local date-time This creates a zoned date-time matching the input local date and time as closely as possible. Obtains an instance of ZonedDateTime from a local date and time. The offset cannot be freely set, as the zone controls which offsets are valid. The zone ID is used to obtain the rules for how and when the offset changes. The offset and local date-time are used to define an instant when necessary. Implementation Requirements: A ZonedDateTime holds state equivalent to three separate objects,Ī LocalDateTime, a ZoneId and the resolved ZoneOffset. The equals method should be used for comparisons. ZonedDateTime may have unpredictable results and should be avoided. ( =), identity hash code, or synchronization) on instances of Represents an instant, especially during a daylight savings overlap.Ĭlass use of identity-sensitive operations (including reference equality The ZoneOffset isĪ vital, but secondary, piece of information, used to ensure that the class In terms of design, this class should be viewed primarily as the combination WithEarlierOffsetAtOverlap() and withLaterOffsetAtOverlap(), Previous offset, or the previous offset is invalid, then the earlier offset is Middle of an Overlap, then the previous offset will be retained. Shifted forwards by the length of the Gap, resulting in a date-time in the laterįor Overlaps, the general strategy is that if the local date-time falls in the Middle of a Gap, then the resulting zoned date-time will have a local date-time Instant by obtaining the offset has the potential to be complicated.įor Gaps, the general strategy is that if the local date-time falls in the In an overlap there are local date-time values with two valid offsets.Īny method that converts directly or implicitly from a local date-time to an This is when clocks are set back typicallyĭue to the autumn daylight savings change from "summer" to "winter". In a gap there are local date-time values with no valid offset. This is when clocks jump forward typicallyĭue to the spring daylight savings change from "winter" to "summer". For the vast majority of the year, the normalĬase applies, where there is a single valid offset for the local date-time. By contrast, obtaining the offset for a local date-time Obtaining the offset for an instant is simple, as there is exactly one valid The difference between the two time-lines is the offset from UTC/Greenwich,Ĭonverting between the two time-lines involves calculating the offset using the This class handles conversion from the local time-line of LocalDateTime This class stores all date and time fields, to a precision of nanoseconds,Īnd a time-zone, with a zone offset used to handle ambiguous local date-times. ZonedDateTime is an immutable representation of a date-time with a time-zone. A date-time with a time-zone in the ISO-8601 calendar system,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |