TIMESTAMP WITHOUT TIME ZONE
От | Randy Shelley |
---|---|
Тема | TIMESTAMP WITHOUT TIME ZONE |
Дата | |
Msg-id | cdd1055b0612120947y5e34b32eqc653f6421242b3d8@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: TIMESTAMP WITHOUT TIME ZONE
Re: TIMESTAMP WITHOUT TIME ZONE |
Список | 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
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 по дате отправления: