Class Datetime.TimestampTZ.AsOffsetDateTime

java.lang.Object
org.postgresql.pljava.adt.Datetime.TimestampTZ.AsOffsetDateTime
All Implemented Interfaces:
Adapter.Contract<OffsetDateTime>, Adapter.Contract.Scalar<OffsetDateTime>, Datetime.TimestampTZ<OffsetDateTime>
Enclosing interface:
Datetime.TimestampTZ<T>

public static class Datetime.TimestampTZ.AsOffsetDateTime extends Object implements Datetime.TimestampTZ<OffsetDateTime>
A reference implementation that maps to 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.

  • Field Details

  • Method Details

    • construct

      public OffsetDateTime construct(long microsecondsSincePostgresEpoch)
      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 values DT_NOBEGIN or DT_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 interface Datetime.TimestampTZ<OffsetDateTime>
    • store

      public <T> T store(OffsetDateTime d, Datetime.TimestampTZ<T> f) throws SQLException
      Throws:
      SQLException