Constant for the maximum supported offset.
Constant for the maximum supported offset.
The time-zone offset for UTC, with an ID of 'Z'.
Obtains an instance of ZoneOffset
from a temporal object.
Obtains an instance of ZoneOffset
from a temporal object.
A TemporalAccessor
represents some form of date and time information.
This factory converts the arbitrary temporal object to an instance of ZoneOffset
.
The conversion uses the TemporalQueries#offset()
query, which relies
on extracting the OFFSET_SECONDS
field.
This method matches the signature of the functional interface TemporalQuery
allowing it to be used in queries via method reference, ZoneOffset::from
.
the temporal object to convert, not null
the zone-offset, not null
DateTimeException
if unable to convert to an { @code ZoneOffset}
Obtains an instance of ZoneOffset
using the ID.
Obtains an instance of ZoneOffset
using the ID.
This method parses the string ID of a ZoneOffset
to
return an instance. The parsing accepts all the formats generated by
#getId()
, plus some additional formats:
Z
- for UTC+h
+hh
+hh:mm
-hh:mm
+hhmm
-hhmm
+hh:mm:ss
-hh:mm:ss
+hhmmss
-hhmmss
Note that ± means either the plus or minus symbol.
The ID of the returned offset will be normalized to one of the formats
described by #getId()
.
The maximum supported range is from +18:00 to -18:00 inclusive.
the offset ID, not null
the zone-offset, not null
DateTimeException
if the offset ID is invalid
Obtains an instance of ZoneOffset
using an offset in hours.
Obtains an instance of ZoneOffset
using an offset in hours.
the time-zone offset in hours, from -18 to +18
the zone-offset, not null
DateTimeException
if the offset is not in the required range
Obtains an instance of ZoneOffset
using an offset in
hours and minutes.
Obtains an instance of ZoneOffset
using an offset in
hours and minutes.
The sign of the hours and minutes components must match. Thus, if the hours is negative, the minutes must be negative or zero. If the hours is zero, the minutes may be positive, negative or zero.
the time-zone offset in hours, from -18 to +18
the time-zone offset in minutes, from 0 to ±59, sign matches hours
the zone-offset, not null
DateTimeException
if the offset is not in the required range
Obtains an instance of ZoneOffset
using an offset in
hours, minutes and seconds.
Obtains an instance of ZoneOffset
using an offset in
hours, minutes and seconds.
The sign of the hours, minutes and seconds components must match. Thus, if the hours is negative, the minutes and seconds must be negative or zero.
the time-zone offset in hours, from -18 to +18
the time-zone offset in minutes, from 0 to ±59, sign matches hours and seconds
the time-zone offset in seconds, from 0 to ±59, sign matches hours and minutes
the zone-offset, not null
DateTimeException
if the offset is not in the required range
Obtains an instance of ZoneOffset
specifying the total offset in seconds
Obtains an instance of ZoneOffset
specifying the total offset in seconds
The offset must be in the range -18:00
to +18:00
, which corresponds to -64800 to +64800.
the total time-zone offset in seconds, from -64800 to +64800
the ZoneOffset, not null
DateTimeException
if the offset is not in the required range