TIMESTAMP WITHOUT TIME ZONE

From: "Randy Shelley" <randy(dot)shelley(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: TIMESTAMP WITHOUT TIME ZONE
Date: 2006-12-12 17:47:36
Message-ID: cdd1055b0612120947y5e34b32eqc653f6421242b3d8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am stuck, I am getting two different times from the database depending on
the timezone of the system I am querying from.

The story is this:
I have a table name request. It has a column create_dt of type TIMESTAMP
WITHOUT TIME ZONE.

When I query this from jdbc into a java.sql.Timestamp and out put it like
this

java.sql.Timestamp ts= rs.getTimestamp(1);
System.out.println(ts.getTime());

I get different result if I query it from my workstation(US/Easter timezone)
and from the server (GMT timezone).

How can this be?? Please help!

A data type of timestamp without time zone should not do any conversions.
The java.sql.Timestamp does not store any timezone info, just nano seconds
from a date. Some where there is a timezone conversion happening. Why and
how do I prevent it?

My idea is this:
What I save to the database (date & time) should be what I get back no
matter what timezone I save or retrieve it in.

Randy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-12-12 17:55:40 Re: date comparisons
Previous Message Ron Johnson 2006-12-12 17:42:19 Re: Why DISTINCT ... DESC is slow?