Re: Problem with to_date function

From: Kris Jurka <books(at)ejurka(dot)com>
To: Gilberto C Andrade <gilbertoca(at)secad(dot)to(dot)gov(dot)br>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problem with to_date function
Date: 2005-08-22 20:15:45
Message-ID: Pine.BSO.4.62.0508221511580.26056@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jan de Visser 2005-08-22 20:39:42 Re: Problem with to_date function
Previous Message Gilberto C Andrade 2005-08-22 19:31:51 Problem with to_date function