Re: Using YY-MM-DD date input
| От | Bruce Momjian |
|---|---|
| Тема | Re: Using YY-MM-DD date input |
| Дата | |
| Msg-id | 200307252034.h6PKYLX20343@candle.pha.pa.us обсуждение исходный текст |
| Ответ на | Re: Using YY-MM-DD date input (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: Using YY-MM-DD date input
Re: Using YY-MM-DD date input |
| Список | pgsql-general |
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Does anyone use YY-MM-DD for date input?
> > We are considering eliminating it for 7.4. You can still use
> > yyyy-mm-dd, or course.
>
> The way I think the date input parser should work when seeing three
> numeric values is:
>
> 1. If first field has four digits, then format is yyyy-mm-dd.
OK
> 2. If first field is larger than 31, assume format is yy-mm-dd.
> (I'm not totally wedded to this, since it could be argued to be
> allowing the input values to determine the interpretation, which
> is exactly the kind of heuristic that people objected to in the
> dd/mm vs mm/dd discussion last month. It seems reasonable to me,
> but it could be removed without affecting the rest of this proposal.)
I am not excited about this, though you could say it is an extension of
the 4-digit rule. However, I don't like that 30-03-03 is in 2003 and
32-03-03 is in the year 32AD. That seems error-prone to me. :-)
> 3. Otherwise, the format must be one of yy-mm-dd, dd-mm-yy, or mm-dd-yy.
> We should use DateStyle to decide which one of these applies.
I see this as a feature addition, because right now, in 2003, there is
no way to enter a current date with a leading year using only two digits.
Also, if there aren't many people who want it, I am concerned it will
cause confusion, because our datestyle stuff is already complicated.
> There are presently only two input DateStyles ('US' and 'European') but
> it would be trivial to add a third to accept yy-mm-dd. We'd only need
> to figure out what to call it. I'm tempted to just call it 'YMD' and
> provide 'DMY' and 'MDY' as alternative names for 'US' and 'European'.
Now, that is an interesting idea, and I wonder if they aren't better
than US and European (and German), because they are more general.
Is this something we want to do in feature freeze?
> We could also use datestyle to decide what to do with ambiguous inputs
> like 03-FEB-01 --- given a 3-way input DateStyle, I'd say YMD should
> mean that the year is first, while the other two mean the day is first.
Interesting.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
В списке pgsql-general по дате отправления: