0
startDate.setTime(validationDate);
endDate.setTime(prevDutyEndDate);
noOfDays=Math.abs((Long)((startDate.getTimeInMillis() - endDate.getTimeInMillis())/(1000 * 60 * 60 * 24)));

In above code snippets startDate is set as March 7th 00:00:00 2018 and endDate is set as March 14th 00:00:00. In CST due day light savings adjustment on March 11th noOfDays calculated is giving 6.95 instead of 7. How can I handle DST adjustment through code and get the value as 7.

Santosh
  • 874
  • 11
  • 21
Sagar Pati
  • 17
  • 1
  • 5
  • Can you just use `java.time.LocalDate` instead of `java.util.Calendar`? That would be the best starting point, IMO... – Jon Skeet Mar 28 '18 at 06:18

1 Answers1

1

You round to the nearest integer

Paul Janssens
  • 622
  • 3
  • 9