Re: Day of month defaults to 1 in TO_DATE

From: Andy Sayer <andysayer_at_gmail.com>
Date: Fri, 8 Mar 2019 18:45:32 +0000
Message-ID: <CACj1VR6S9j4XjD-=3XxMoNz8o=wM+Jgczj9M2pgWcyAbgjXsoQ_at_mail.gmail.com>



Hi Rich,

It’s documented in the globalisation guide at least https://docs.oracle.com/cd/E11882_01/server.112/e10729/ch4datetime.htm#NLSPG004

“If you specify a date value without a time component, then the default time is midnight. If you specify a date value without a date, then the default date is the first day of the current month.”

I only managed to find it because I added “current month” to my google!

Thanks,
Andy

On Fri, 8 Mar 2019 at 17:01, Rich J <rjoralist3_at_society.servebeer.com> wrote:

> Hey all,
>
> In versions 11.2.0.3, 12.1.0.2, 12.2.0.1, and 18 XE, I've run this:
>
> SQL> alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS';
>
> Session altered.
>
> SQL> SELECT TO_DATE('19:09:47','HH24:MI:SS') FROM DUAL;
>
> TO_DATE('19:09:47',
> -------------------
> 2019/03/01 19:09:47
>
> The day of the month defaults to 1 in each case (today is the 8th and I've
> run it on several other days). Is this documented somewhere? It seems
> like I should have run into this before, or maybe just forgot over the last
> 20 years...
>
> Thanks,
> Rich
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Mar 08 2019 - 19:45:32 CET

Original text of this message