Java LocalTime get minutes elapsed between two LocalTime values

Description

Java LocalTime get minutes elapsed between two LocalTime values

import java.time.LocalTime;
import java.time.temporal.ChronoUnit;

public class Main {
  public static void main(String[] args) {
     //from   www .  ja  va  2s.  co m
     LocalTime lt1 = LocalTime.of(7, 0);
     LocalTime lt2 = LocalTime.of(9, 30);


     long minutes = lt1.until(lt2, ChronoUnit.MINUTES);
     System.out.println(minutes);

  }
}



PreviousNext

Related