Re: Date not being parsed as expected

From: Mario Weilguni <mweilguni(at)sime(dot)com>
To: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Date not being parsed as expected
Date: 2002-09-07 07:37:22
Message-ID: 200209070937.22775.mweilguni@sime.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joel Rodrigues 2002-09-07 09:19:45 Fwd: "...integer[] references..." = error
Previous Message Jason Earl 2002-09-06 23:33:29 Re: Surprise :-(