From: | Dave Cramer <pg(at)fastcrypt(dot)com> |
---|---|
To: | Vinayak <vinpokale(at)gmail(dot)com> |
Cc: | List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Problem with DATE |
Date: | 2015-01-14 11:40:43 |
Message-ID: | CADK3HHLLUh3AiTqhVgWRfwoqXaj3hicMAg-SuD4X0qoMoRvbAw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)gmail(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-jdbc
>
From | Date | Subject | |
---|---|---|---|
Next Message | Vinayak | 2015-01-16 05:35:06 | Re: Problem with DATE |
Previous Message | Vinayak | 2015-01-14 05:34:57 | Re: Problem with DATE |