I have two time stamps in date format.
How can I get the number of days that are present in the given range ?
SimpleDateFormat sdf = new SimpleDateFormat("dd MM yyyy HH:mm:ss");
Date begin=sdf.parse("27 02 2014 23:00:00");
Date end=sdf.parse("01 03 2014 00:00:10");
In the above case it must be 3, that is (27th Feb , 28th Feb and 1st Jan)
int days = (int) (end.getTime() - begin.getTime())/(1000*3600*24) ;
The above method doesn't help as it considers the whole time stamp.