Re: TIMESTAMP WITHOUT TIME ZONE

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Richard Troy <rtroy(at)ScienceTools(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard Huxton <dev(at)archonet(dot)com>, Randy Shelley <randy(dot)shelley(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: TIMESTAMP WITHOUT TIME ZONE
Date: 2006-12-15 22:33:23
Message-ID: 20061215223322.GZ14237@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Troy wrote:

> I'd appreciate a clean yes/no; From a Java application, throught PG in
> both directions, the same timestamp comes back that was handed to the JDBC
> driver so long as it's stored in a "timestamp without time zone"
> attribute, nomatter neither where on earth the insert/update originates,
> nor where the select originates? Same bits, yes? Otherwise, "Houston,
> we've got a problem."

If you pass a timestamp without time zone, the given timestamp will be
given back to you on request, no changes applied, whatever the timezone
either the inserter or the extracter are on.

If you pass a timestamp with time zone, the time will be rotated to UTC
on insert depending on the inserter's timezone (thus it's stored as
UTC), and will be rotated "back" to the extracter's timezone when you
extract it. Note that both timezones may be different, so the numbers
you get may be different than the numbers you put in, but they will
signal exactly the same instant in time (in the appropriate time zone).

If you want to know what time zone the inserter used, you would store
that in a separate column.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-12-15 22:35:15 Re: TIMESTAMP WITHOUT TIME ZONE
Previous Message Richard Troy 2006-12-15 22:18:29 Re: TIMESTAMP WITHOUT TIME ZONE