to_date problem.

Started by lewwidalmost 24 years ago2 messagesbugs
Jump to latest
#1lewwid
lewwid@telusplanet.net

select to_date('December 12 2002','Month dd yyyy');
to_date
------------
2002-12-02

select to_date('January 12 2002','Month dd yyyy');
to_date
------------
0005-06-24 <----- Problem right there.

select to_date('January 12, 2002','Month dd, yyyy');
to_date
------------
2002-01-01 <-- It should be 2002-01-12

select to_date('December 12, 2002','Month dd yyyy');
to_date
------------
2002-12-02

For some reason it's getting caught up on January. I know these dates are
Unambiguous however I think there might be a bug there.

It would be my first bug ;)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: lewwid (#1)
Re: to_date problem.

lewwid <lewwid@telusplanet.net> writes:

select to_date('January 12 2002','Month dd yyyy');
to_date
------------
0005-06-24 <----- Problem right there.

I think you need FM:

regression=# select to_date('January 12 2002','FMMonth dd yyyy');
to_date
------------
2002-01-12
(1 row)

Without that, the to_date scanner assumes it should be dealing with
fixed-width fields. I think this is moderately broken myself, but
maybe that's the way Oracle does it...

regards, tom lane