I have two dates:
Date dt1 = new Date("04/11/2013 11:00:00");//date
Date dt2 = new Date("04/12/2013 11:00:00");
Then I process with this code to know how much week between dt1
and dt2
double tanggal = (dt2.getTime() - dt1.getTime()) / (24 * 60 * 60 * 1000);
double week= (double) Math.ceil(tanggal/7);
I tried to run this code and the result week is 1.0
, but when the dt2
is 04/11/2013 11:00:01
, the result week is 0.0
.
How to change the result so the result week is 1.0
if dt2
is 04/11/2013 11:00:01
? And I want, when the dt2
until the seventh day or 04/18/2013 11:00:01
the result change to 2.0
. How to do that?