Re: strange date behaviour

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 2000/07/04
Message-ID: <8jsu6j$ggb$1_at_nnrp1.deja.com>#1/1


In article <8jrgpv$4u03_at_inetbws1.citec.com.au>,   cjundieseastwd_at_powerup.com.au (Obakesan) wrote:
> HiYa
>
> how come the date component defaults to another date other than today
> when I do a to_date() and don't supply a year?
>
> IE
>
> SQL> select to_date('17:00 00','HH24:MI SS') from dual;
>
> TO_DATE('
> ---------
> 01-JUL-00
>
> but when I look at the sysdate that I would have expeceted it to
> defalult to it's indeed correct.
>
> SQL> select sysdate from dual;
>
> SYSDATE
> ---------
> 04-JUL-00
>
> what am I missing??
>
> thanks
>
> --
>
> See Ya
> (when the bandwidth gets better ;-)
> Chris Eastwood Please remove undies for
 reply
> Photographer, Stunt Programmer WWW ->
 www.powerup.com.au/~cjeastwd/
> Motorcyclist and dingbat
>
>

goto
http://technet.oracle.com/doc/oracle8i_816/server.816/a76989/ch23.htm#37 627

[Quoted] and search for "first day of" on that web page. Its chapter 2 of the SQL reference about the DATE datatype -- this is the defined behaviour.

if you want to get the date to be today -- you would:

select
to_date( to_char(sysdate,'ddmmyyyy')||'17:00 00','ddmmyyyyHH24:MI SS')  from dual;

or something similar.

--
[Quoted] Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries
Howtos and such: http://osi.oracle.com/~tkyte/index.html
Oracle Magazine: http://www.oracle.com/oramag
Opinions are mine and do not necessarily reflect those of Oracle Corp


Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Tue Jul 04 2000 - 00:00:00 CEST

Original text of this message