Re: Oracle's months_between -function

From: Shakespeare <whatsin_at_xs4all.nl>
Date: Tue, 02 Feb 2010 09:03:05 +0100
Message-ID: <4b67dc40$0$22913$e4fe514c_at_news.xs4all.nl>



Op 1-2-2010 14:39, eh schreef:
> Hi,
> is there an obviuos explanation to this case; months_between -function
> seems to act a little weird with time given:
> ===========
> select months_between(to_date('02.02.2010','dd.mm.yyyy'),to_date
> ('01.02.2010', 'dd.mm.yyyy'))
> from dual
> ---> 0.0322
> ===========
> ... and then we add times to the mask
> ===========
> select months_between(to_date('02.02.2010 00:00:01','dd.mm.yyyy
> hh24:mi:ss'),to_date('01.02.2010 23:59:59', 'dd.mm.yyyy hh24:mi:ss'))
> from dual
> ---> 7,467
> ===========
> How about that ???
> is it so simple that do not use time-format with monts_between .???
> BR,
> timo

Did you notice that the first calculation is 1 day, the latter 2 seconds? And like Thomas stated: you're missing a part of your result because your column width is to small.

Shakespeare Received on Tue Feb 02 2010 - 02:03:05 CST

Original text of this message