Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> writes:
>> I dunno whether there is any actual spec for to_date(), but I do agree
>> that if you've specified a 2-digit YY format, something 2000-centric
>> would be more useful than the current behavior.
>> It doesn't seem to be doing anything particularly sensible with a
>> 4-digit date, either:
>> regression=# select to_date( '00001112', 'YYYYMMDD');
>> (1 row)
>> This case I *would* have expected to produce 1 BC, but nope...
> Where is *guarantee* that the year is 4-digits?!
Who said anything about a guarantee? In the cases at hand, the number
of Y's appearing in the format string should give you a sufficient clue
about how to behave. In fact, if I were you I'd reject a format string
that had a number of Y's other than 2 or 4, because then it really isn't
very clear what you're supposed to do.
> And 'YY' - it's hell, what is '00'? ... 1900 or 2000 or 20000?
It should work the same as the timestamp input converter. Thomas
Lockhart could give you more details about exactly what that code does.
It's probably assuming that the intended value of a 2-digit year is
between 1970 and 2069, or some other 100-year range that contains
Assuming that YY = '00' means 1 BC is definitely not reasonable
behavior, at least not in the USA. 2-digit year notations are
very common here, and no one uses them that way ;-)
regards, tom lane
In response to
pgsql-bugs by date
|Next:||From: Limin Liu||Date: 2000-11-09 02:15:30|
|Subject: unreachable block|
|Previous:||From: Kate Collins||Date: 2000-11-08 15:16:59|
|Subject: Re: to_date problems (Re: Favor for Postgres User at WSI)|