Re: Date not being parsed as expected - Mailing list pgsql-general

From Mario Weilguni
Subject Re: Date not being parsed as expected
Date
Msg-id 200209070937.22775.mweilguni@sime.com
Whole thread Raw
In response to Date not being parsed as expected  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
List pgsql-general
Am Freitag, 6. September 2002 09:24 schrieb Jean-Christian Imbeault:
> The following insert:
>
> insert into t values('01-10-29')
>
> gives the following result in the DB:
>
> select * from t
>       d
> ------------
>   2029-01-10
>
> Why is the first part (01) being parsed as the month? The DateStyle is
> set to ISO (the default) so shoudln't the parser see xx-yy-zz as being
> year-month-day?
>

You can easily avoid this when using to_date(), e.g.:
insert into t values (to_date('01-10-29', 'dd-mm-yy'))

(or whatever this date should be). It's a bit more work to write, however you'll be
on the safe side.

Regards,
    Mario Weilguni


pgsql-general by date:

Previous
From: Jason Earl
Date:
Subject: Re: Surprise :-(
Next
From: Joel Rodrigues
Date:
Subject: Fwd: "...integer[] references..." = error