Re: Date format problem with INSERT statement.

From: "Xavier Poinsard" <xpoinsard(at)free(dot)fr>
To: Olav Gjerde <olavgjerde(at)yahoo(dot)no>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Date format problem with INSERT statement.
Date: 2006-04-13 14:51:24
Message-ID: 443E656C.20003@free.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

You should consider using the jdbc escape format for dates {d
'yyyy-mm-dd'} =>
INSERT INTO wdata (date) VALUES ({d '2006-04-13');

see http://jdbc.postgresql.org/documentation/head/escapes-datetime.html

Olav Gjerde a écrit :
> If I do an:
>
> INSERT INTO wdata (date)
> VALUES ('13.04.06');
>
> From the Query Tool in PGAdmin it will insert the dd.mm.yy format
> correctly without problems.
>
>
> But when I do this in Java I get this error message
>
> SQLException: ERROR: date/time field value out of range: "13.04.06"
> SQLState: 22008
> VendorError: 0
>
> This is because it reads the date format as mm.dd.yy because when I
> insert with the value '12.04.06' it works perfect. I've changed the
> datestyle in my Database to European but it still doesn't work. Do the
> JDBC driver only insert dates in the US format?
>
> Olav

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Leif B. Kristensen 2006-04-13 15:29:49 Re: browser shows garbage instead of UTF-8 characters
Previous Message Olav Gjerde 2006-04-13 14:38:14 Date format problem with INSERT statement.