Java Data Type How to - Get the Duration for two Instant


We would like to know how to get the Duration for two Instant.


//  ww w . j a  v  a2s. c om
import java.time.Duration;
import java.time.Instant;

public class Main {
  public static void main(String[] args) {
    Instant firstInstant = Instant.ofEpochSecond(1294881180); 
    Instant secondInstant = Instant.ofEpochSecond(1294708260); 

    Duration between = Duration.between(firstInstant, secondInstant);


The code above generates the following result.