TIMESTAMP WITHOUT TIME ZONE - Mailing list pgsql-general

From Randy Shelley
Subject TIMESTAMP WITHOUT TIME ZONE
Date
Msg-id cdd1055b0612120947y5e34b32eqc653f6421242b3d8@mail.gmail.com
Whole thread Raw
Responses Re: TIMESTAMP WITHOUT TIME ZONE
Re: TIMESTAMP WITHOUT TIME ZONE
List 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



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: indexed function performance
Next
From: Jeremy Harris
Date:
Subject: Re: Postgres friendly RegEx?