Re: Re: to_date problems (Re: Favor for Postgres User at WSI)

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kate Collins <klcollins(at)wsicorp(dot)com>, pgsql-bugs(at)postgresql(dot)org, John Rickman <john(dot)rickman(at)greatbridge(dot)com>
Subject: Re: Re: to_date problems (Re: Favor for Postgres User at WSI)
Date: 2000-11-09 07:41:30
Message-ID: Pine.LNX.3.96.1001109083342.20626J-100000@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Wed, 8 Nov 2000, Tom Lane wrote:

> 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');
> >> to_date
> >> ------------
> >> 1112-11-12
> >> (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
> current time.
>
> 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 ;-)

OK, OK... we gain me. Support something for this small country between
Canada and Mexico is probably pretty think. But else in the heaven I will
say that 'YY' is the hell...

7.1 resolve it.
Karel

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sean Kelly 2000-11-09 16:14:09 Re: backend closed the channel unexpectedly?!?
Previous Message Limin Liu 2000-11-09 02:15:30 unreachable block