Java LocalTime get minutes between two LocalTime values via until method

Description

Java LocalTime get minutes between two LocalTime values via until method


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

public class Main {
  public static void main(String[] args) {
    LocalTime lt1 = LocalTime.of(7, 0);
    LocalTime lt2 = LocalTime.of(9, 30);

    long minutes = lt1.until(lt2, ChronoUnit.MINUTES);
    System.out.println(minutes);/* w w  w . j a  v  a  2  s.c  o m*/
  }
}



PreviousNext

Related