Java LocalDate Calculate getTimeDifferenceInDays(LocalDate to)

Here you can find the source of getTimeDifferenceInDays(LocalDate to)

Description

get Time Difference In Days

License

Open Source License

Declaration

public static long getTimeDifferenceInDays(LocalDate to) 

Method Source Code

//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
}

Related

  1. getLocalDateBydayAndWeek(LocalDate localDate, int weekNumber, int dayNumber)
  2. getLrsLocalDate(String lbdcDate)
  3. getMax(@Nonnull final LocalDate aDate1, @Nonnull final LocalDate aDate2)
  4. getNextNoWeekedDay(LocalDate today)
  5. getQuarterBounds(final LocalDate date)
  6. getTodayAsLocalDate()
  7. getWeekOfTheYear(final LocalDate dateOfYear)
  8. getYearMonth(LocalDate localDate)
  9. isActual(LocalDate before, LocalDate after)