Java LocalDateTime to getDurationInMillis(LocalDateTime from, LocalDateTime to)

Here you can find the source of getDurationInMillis(LocalDateTime from, LocalDateTime to)

Description

get Duration In Millis

License

Apache License

Declaration

public static long getDurationInMillis(LocalDateTime from, LocalDateTime to) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.time.LocalDateTime;
import java.time.ZoneOffset;

public class Main {
    public static long getDurationInMillis(LocalDateTime from, LocalDateTime to) {
        return getInMillis(to) - getInMillis(from);
    }// w w w  .  ja va2s . co m

    private static long getInMillis(LocalDateTime time) {
        return time.toInstant(ZoneOffset.ofTotalSeconds(0)).toEpochMilli();
    }
}

Related

  1. fromLocalDateTime(LocalDateTime _ldt)
  2. getDate(LocalDateTime time)
  3. getDateTimeText(LocalDateTime dateTime)
  4. getDelayUntil(final LocalDateTime ldt)
  5. getDifference(LocalDateTime sourceTime, LocalDateTime targetTime)
  6. getDurationString(LocalDateTime start, LocalDateTime end, ChronoUnit unit)
  7. getHoursElapsed(LocalDateTime fromDate)
  8. getMillis(LocalDateTime time)
  9. getMinuteOfDay(LocalDateTime ldt)