Re: Q: Default month in TO_DATE
Date: Sat, 10 Jan 2009 17:54:51 -0800
Message-ID: <Pine.GSO.4.58.0901101751480.26205_at_vtn1.victoria.tc.ca>
On Sun, 11 Jan 2009, Maxim Demenko wrote:
> Malcolm Dew-Jones schrieb:
> > I don't see this in the TO_DATE documentation, and because it's January I
> > can't see how to test this to confirm.
> >
> > select to_date('2009','YYYY') from dual;
> > => shows 01-JAN-2009
> >
> > The day is defaulting to 1, but what of the month?
> >
> > - is the unspecified month defaulting to 1 (i.e. January)
> >
> > - or is the unspecified month defaulting to the current month (which just
> > happens to be January because of when I ran the test).
> >
> >
> > Thanks for any feedback.
> >
>
> From
> http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/datatypes.htm#sthref795
>
> DATE Datatype
>
> You use the DATE datatype to store fixed-length datetimes, which include
> the time of day in seconds since midnight. The date portion defaults to
> the first day of the current month; the time portion defaults to
> midnight. The date function SYSDATE returns the current date and time.
>
> So, if you query the same in february, you'll get 01-FEB-2009
>
Thanks,
I didn't think to look at the _data type_ documentation, I was looking at the conversion functions (TO_DATE from char). Received on Sat Jan 10 2009 - 19:54:51 CST