From: Xavier Poinsard <xpoinsard@free.fr>
To: Olav Gjerde <olavgjerde@yahoo.no>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Date format problem with INSERT statement.
Date: Thu, 13 Apr 2006 16:51:24 +0200
Message-ID: <443E656C.20003@free.fr> (raw)
In-Reply-To: <20060413143814.60372.qmail@web86913.mail.ukl.yahoo.com>
References: <20060413143814.60372.qmail@web86913.mail.ukl.yahoo.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: xpoinsard@free.fr, olavgjerde@yahoo.no
Subject: Re: Date format problem with INSERT statement.
In-Reply-To: <443E656C.20003@free.fr>
References: <20060413143814.60372.qmail@web86913.mail.ukl.yahoo.com> <443E656C.20003@free.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox