distance between LocalDateTime - Java java.time

Java examples for java.time:LocalDateTime

Description

distance between LocalDateTime

Demo Code


//package com.java2s;

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

public class Main {
    public static long distance(LocalDateTime start, LocalDateTime end) {
        return end.toEpochSecond(ZoneOffset.UTC)
                - start.toEpochSecond(ZoneOffset.UTC);
    }//from   w w w  . ja  v  a2 s.  c  o  m
}

Related Tutorials