Обсуждение: TO_DATE and single digit months driving me nuts...

Поиск
Список
Период
Сортировка

TO_DATE and single digit months driving me nuts...

От
Philip Hallstrom
Дата:
Hi -
    I'm playing around with inserting dates into a timestamp field and
am getting annoyed at single digit dates/days/hours/minutes.
The problem is that I have something like:
TO_TIMESTAMP('2000 5 25 09 30', 'YYYY MM DD HH24 MI')
which fails because it expects the month to be "05" instead of "5".  Other
than pad all these myself in my code, is there some way to tell the
formatter to allow for missing leading zeros?  Something similar to the
"fm" format option, but a bit different...
Thanks!
-philip


Re: TO_DATE and single digit months driving me nuts...

От
Karel Zak
Дата:
On Tue, 23 May 2000, Philip Hallstrom wrote:

> Hi -
>     I'm playing around with inserting dates into a timestamp field and
> am getting annoyed at single digit dates/days/hours/minutes.
> The problem is that I have something like:
> TO_TIMESTAMP('2000 5 25 09 30', 'YYYY MM DD HH24 MI')

If I good understand you:

test=# select TO_TIMESTAMP('2000 5 25 09 30', 'YYYY FMMM DD HH24 MI');
      to_timestamp
------------------------
 2000-05-25 09:30:00+02

The 'FM' (fill-mode) is a local option and is always used for next element.
In your example for 'MM'. Without 'FM' formatter expect full number.

                             Karel


Re: TO_DATE and single digit months driving me nuts...

От
Mike Mascari
Дата:
Karel Zak wrote:
>
> On Tue, 23 May 2000, Philip Hallstrom wrote:
>
> > Hi -
> >       I'm playing around with inserting dates into a timestamp
> > field and am getting annoyed at single digit
> > dates/days/hours/minutes. The problem is that I have something like:
> > TO_TIMESTAMP('2000 5 25 09 30', 'YYYY MM DD HH24 MI')
>
> If I good understand you:
>
> test=# select TO_TIMESTAMP('2000 5 25 09 30', 'YYYY FMMM DD HH24 MI');
>       to_timestamp
> ------------------------
>  2000-05-25 09:30:00+02
>
> The 'FM' (fill-mode) is a local option and is always used for next element.
> In your example for 'MM'. Without 'FM' formatter expect full number.
>
>                                                         Karel

Wow! That is nice. That's one damned good implementation of the
ORACLE TO_xxx routines. :-)

MIke Mascari

Re: TO_DATE and single digit months driving me nuts...

От
Karel Zak
Дата:
> > The 'FM' (fill-mode) is a local option and is always used for next element.
> > In your example for 'MM'. Without 'FM' formatter expect full number.
> >
> >                                                         Karel
>
> Wow! That is nice. That's one damned good implementation of the
> ORACLE TO_xxx routines. :-)

 Oh, thanks.

BTW --- We not have marketing-department, we must create good software
        that make good publicity itself :-)))


                            Karel