Re: Problem with to_date function - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Problem with to_date function
Date
Msg-id Pine.BSO.4.62.0508221511580.26056@leary.csoft.net
Whole thread Raw
In response to Problem with to_date function  (Gilberto C Andrade <gilbertoca@secad.to.gov.br>)
List pgsql-jdbc

On Mon, 22 Aug 2005, Gilberto C Andrade wrote:

> I would like to know if the following is the expected result:
> from psql:
> bcoproducao=# select to_date(current_date, 'DD/MM/YYYY'), current_date;
> to_date   |    date
> ------------+------------
> 22/08/2005 | 22/08/2005
> (1 row)
>

This query depends on the setting of the DateStyle parameter which
determines how current_date is turned into text before being passed into
to_date.  The JDBC driver sets DateStyle to ISO on connection startup so
that it can send and receive dates in this format.  Unfortunately it seems
to_date doesn't error out with "improper date format" or similar, but just
tries to make a best guess at what you really wanted.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Jan de Visser
Date:
Subject: Re: Problem with to_date function
Next
From: Kris Jurka
Date:
Subject: Re: Problem with to_date function