/** * @author lautturi.com * Java example:compute the days between two dates in java */ import java.time.LocalDate; import java.util.*; import java.time.temporal.*; public class Lautturi { public static void main(String[] args) { LocalDate start = LocalDate.parse("2020-10-03"); LocalDate end = LocalDate.parse("2020-12-05"); long diff = ChronoUnit.DAYS.between(start, end); System.out.println("number of days:"+diff); } }
output:
number of days:63