Re: Problem with DATE

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: Problem with DATE
Дата
Msg-id CADK3HHLLUh3AiTqhVgWRfwoqXaj3hicMAg-SuD4X0qoMoRvbAw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Problem with DATE  (Vinayak <vinpokale@gmail.com>)
Ответы Re: Problem with DATE  (Vinayak <vinpokale@gmail.com>)
Список pgsql-jdbc
Vinayak,

A bug, no. An interesting artifact yes.

The problem here is that java dates have timezones and times. 

These selects were done in my timezone EST

test=> select date('2005-01-01' at time zone 'gmt+6') ;
    date
------------
 2004-12-31
(1 row)

test=> select date('2005-01-01' at time zone 'gmt-6') ;
    date
------------
 2005-01-01

the reason behind this is:

test=> select '2005-01-01' at time zone 'gmt-6';
      timezone
---------------------
 2005-01-01 11:00:00
(1 row)

test=> select '2005-01-01' at time zone 'gmt+6';
      timezone
---------------------
 2004-12-31 23:00:00
(1 row)

I am guessing what you really want is to just take the date in your Oracle db, load it into java and store it into postgresql without  any transformation.

This would require a custom date type.



Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

On 14 January 2015 at 00:34, Vinayak <vinpokale@gmail.com> wrote:
Hi,
Thank you for reply.
>No there is no similar problem for Date as there is only one date type in
postgresql. If all you need is >date then you should able to use that
Understood.

PreparedStatement throws error for date parameter
org.postgresql.util.PSQLException: ERROR: could not determine data type of
parameter $4

Is this a bug?



-----
Regards,
Vinayak,

--
View this message in context: http://postgresql.nabble.com/Problem-with-DATE-tp5833008p5833860.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.


--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Vinayak
Дата:
Сообщение: Re: Problem with DATE
Следующее
От: Vinayak
Дата:
Сообщение: Re: Problem with DATE