After consulting a few forums, I ended up using the code below to find the days difference. But, I see a problem with the logic (may be it\'s my over sight?). I see that for
At least in the current version your code prints correct results
11 to 11 = 0
11 to 12 = 1
11 to 13 = 2
11 to 14 = 3
11 to 15 = 4
11 to 16 = 5
11 to 17 = 6
11 to 18 = 7
11 to 19 = 8
Nevertheless new Date((2013 + 1900), (1 + 1), 11);
is incorrect, in fact it is 5813-03-01
. It should be new Date((2013 - 1900), (1 - 1), 11);
see Date(int year, int month, int day) API
Parameters:
year - the year minus 1900.
month - the month between 0-11.
date - the day of the month between 1-31.