pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Wall <d.wall@computer.org>
To: pgsql-jdbc@postgresql.org
Subject: Java 8 OffsetDateTime clarification
Date: Mon, 6 May 2019 19:31:52 -0700
Message-ID: <e0892e70-ffcb-6161-bbc9-3f710dd52593@computer.org> (raw)

In the JDBC document about Java 8 date and times, it says, "Also note 
that all OffsetDateTime instances will have be in UTC (have offset 0). 
This is because the backend stores them as UTC.

Ref: https://jdbc.postgresql.org/documentation/head/java8-date-time.html

This seems incorrect to me.  The backend, when using TIMESTAMP WITH TIME 
ZONE, stores the date+time+tzoffset, and they are not all 0 (for 
example, PSQL SELECT show such fields like "2019-04-18 
07:35:25.061-07".  And of course OffsetDateTime seems to align with 
TIMESTAMP WITH TIME ZONE.  Lastly, I seem to be able to 
ResultSet.getObject() and PreparedStatement.setObject() with 
OffsetDateTime param without them all having offset 0 (I don't force the 
OffsetDateTime to be in the UTC zone), and they look correct.

Can you clarify if that statement in the documentation is correct?  I 
want to make sure I code this correctly as I'm updating from the older 
use of java.sql.Timestamp for this purpose.

Thanks,
David








view thread (3+ messages)  latest in thread

Message-ID: <e0892e70-ffcb-6161-bbc9-3f710dd52593@computer.org>
Permalink:  ../e0892e70-ffcb-6161-bbc9-3f710dd52593@computer.org/
Also on:    postgresql.org/message-id/e0892e70-ffcb-6161-bbc9-3f710dd52593@computer.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: d.wall@computer.org
  Subject: Re: Java 8 OffsetDateTime clarification
  In-Reply-To: <e0892e70-ffcb-6161-bbc9-3f710dd52593@computer.org>
  References: <e0892e70-ffcb-6161-bbc9-3f710dd52593@computer.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox