Class Datetime.TimestampTZ.AsOffsetDateTime
- All Implemented Interfaces:
Adapter.Contract<OffsetDateTime>
,Adapter.Contract.Scalar<OffsetDateTime>
,Datetime.TimestampTZ<OffsetDateTime>
- Enclosing interface:
Datetime.TimestampTZ<T>
OffsetDateTime
.
A value from PostgreSQL is always understood to be at UTC, and
will be mapped always to an OffsetDateTime
with UTC as
its offset.
A value from Java is adjusted by its offset so that PostgreSQL will
always be passed microsecondsSincePostgresEpochUTC
.
The PostgreSQL "-infinity" and "+infinity" values are mapped to
instances whose corresponding LocalDateTime
at UTC will match
(by equals
) the constants NOBEGIN
and NOEND
of AsLocalDateTime
, respectively.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.postgresql.pljava.Adapter.Contract
Adapter.Contract.Array<T,
E, A extends Adapter<E, ?>>, Adapter.Contract.Scalar<T> Nested classes/interfaces inherited from interface org.postgresql.pljava.adt.Datetime.TimestampTZ
Datetime.TimestampTZ.AsOffsetDateTime, Datetime.TimestampTZ.Modifier<T>
-
Field Summary
Fields inherited from interface org.postgresql.pljava.adt.Datetime.TimestampTZ
POSTGRES_EPOCH
-
Method Summary
Modifier and TypeMethodDescriptionconstruct
(long microsecondsSincePostgresEpoch) Constructs a representation T from the components of the PostgreSQL data type.<T> T
store
(OffsetDateTime d, Datetime.TimestampTZ<T> f)
-
Field Details
-
INSTANCE
-
-
Method Details
-
construct
Description copied from interface:Datetime.TimestampTZ
Constructs a representation T from the components of the PostgreSQL data type.The argument represents microseconds since midnight UTC on
POSTGRES_EPOCH
.Given any desired local time zone, conversion to/from this value is possible if the rules for that time zone as of the represented date are available.
The argument represents microseconds since
POSTGRES_EPOCH
, unless it is one of the special valuesDT_NOBEGIN
orDT_NOEND
.When constructing a representation that lacks notions of positive or negative "infinity", one option is to simply map the above special values no differently than ordinary ones, and remember the two resulting representations as the "infinite" ones. If that is done without wraparound, the resulting "-infinity" value will precede all other PostgreSQL-representable dates and the resulting "+infinity" will follow them.
The older
java.util.Date
cannot represent those values without wraparound; the two resulting values can still be saved as representing -infinity and +infinity, but will not have the expected ordering with respect to other values. They will both be quite far from the present.- Specified by:
construct
in interfaceDatetime.TimestampTZ<OffsetDateTime>
-
store
- Throws:
SQLException
-