in the first query the difference between the dates '2010-07-31' and '2010-06-30' and the result is "1"

and

in the first query the difference between the dates '2010-07-30' and '2010-06-30' and the result "1"which is wrong. because the diference between the dates in 2nd query should come "0" but it is coming "1"