Java LocalTime get minutes between two LocalTime values

Description

Java LocalTime get minutes between two LocalTime values


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 = ChronoUnit.MINUTES.between(lt1, lt2);
    System.out.println(minutes);/*  w w  w.ja va2s.  c o m*/
  }
}



PreviousNext

Related