substrating two dates doen' give the right value

I have this SQL code:

SELECT date( ‘2013-08-01’ ) - date( ‘2013-07-31’ )
FROM dual;

The result should be 1, but it’s 70.

Anybody has any clue why this happens ?

Thanks in advance for any feeback



I solved it !! By subtracting the two dates from php

Thanks anyway


Your database could be buggy. Which database did you use?
I tried it in Postgres and it worked correctly:

SELECT date('2013-08-01') - date('2013-07-31')

I use MySql. Anyway, I solved by subtracting the 2 dates via php

thanks for your time

For MySQL:

SELECT DATEDIFF(‘2013-08-01’,‘2013-07-31’);