Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Date Query y2k
The following query works doesn't work after the year 2000 (it does
before)
select TO_CHAR(TimeStamp,'MM-DD-YYYY') from MyTable where TimeStamp >= TO_DATE('01-01-2000','MM-DD-YYYY') AND TimeStamp <= TO_DATE('01-02-2000','MM-DD-YYYY')
Upon closer inspection, it appears as though the date TO_DATE('01-01-2000','MM-DD-YYYY') is greater than any date in the database, including dates after 1/1/2000.
The next query is the same as the first except the first date is in 1999 and the second in 2000
select TO_CHAR(TimeStamp,'MM-DD-YYYY') from MyTable where TimeStamp >= TO_DATE('12-31-1999','MM-DD-YYYY') AND TimeStamp <= TO_DATE('01-01-2000','MM-DD-YYYY')
This query returns every row after 12/31/1999 since oracle is treating
TO_DATE('01-01-2000','MM-DD-YYYY')
as very big.
Does someone have insight as to why this is? btw i'm using 8.0.4. Received on Fri Jan 21 2000 - 13:51:49 CST
![]() |
![]() |