I have two dates. I am getting dates from database like this:-
Date d = new Date();
Date dTarget = finance.getTargetDate();
at the moment my d is 2017-12-29
and dTarget is 2017-12-31
Now i am trying to calculate the number of days in between them using Joda time api. I expect number of days to be 2 but at the moment I am getting 1, which I think is incorrect.
My timezone is UTC+5:45
//joda initital datetime
DateTime intdt = new DateTime(new Date());
DateTime targetDt = new DateTime(dTarget);
int noOfDays = Days.daysBetween(intdt,targetDt).getDays();
System.out.println(noOfDays);
Am I finding the difference between two dates correctly? Why is it not showing 2 for this case?