Here you can find the source of getTimeDifferenceInDays(LocalDate to)
public static long getTimeDifferenceInDays(LocalDate to)
//package com.java2s; //License from project: Open Source License import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; import java.util.Date; import java.util.concurrent.TimeUnit; public class Main { public static long getTimeDifferenceInDays(LocalDate to) { Date today = new Date(); Date past = Date.from(Instant.from(to.atStartOfDay(ZoneId.systemDefault()))); long c = (today.getTime() - past.getTime()) - 60 * 60 * 1000; return TimeUnit.DAYS.convert(c, TimeUnit.MILLISECONDS); }//from w w w .ja va 2s . com }