Mick Francis - 2019-05-07

Hi,

DATEDIFF appears not to be counting interval boundaries like it should, but rather rounding the floating point difference. For example, both expressions in the following should evaluate to 1, as they are in different days:

select datediff('d',#1961-08-04 22:30:59#, #1961-08-05 10:30:59#),
       datediff('d',#1961-08-04 22:30:59#, #1961-08-05 10:31:00#)
from dual;

·----+----·
| C1 | C2 |
·----+----·
|  0 |  1 | Should both be 1
·----+----·

I can work around this by using TIMESTAMPDIFF.

Kind regards,

Mick.

 

Last edit: Mick Francis 2019-05-07