Java tutorial
import java.time.LocalTime; import java.time.format.DateTimeFormatter; public class Main { public static void main(String[] args) { LocalTime d = LocalTime.now(); DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("HH:mm"); System.out.println(TIME_FORMATTER.format(d)); } }