Here you can find the source of getDurationInMillis(LocalDateTime from, LocalDateTime to)
public static long getDurationInMillis(LocalDateTime from, LocalDateTime to)
//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(); } }