Java Data Type How to - Create a simple Time - 13:51








Question

We would like to know how to create a simple Time - 13:51.

Answer

import java.time.LocalTime;

public class Main {
  public static void main(String[] argv) {
    LocalTime d =  LocalTime.of(13, 51);
    System.out.println(d);
  }
}

The code above generates the following result.