Here you can find the source of formatTime(LocalDateTime time)
public static String formatTime(LocalDateTime time)
//package com.java2s; //License from project: Open Source License import java.time.LocalDateTime; public class Main { private static final String timeDelimiter = ":"; public static String formatTime(LocalDateTime time) { return String.join(timeDelimiter, String.format("%02d", time.getHour()), String.format("%02d", time.getMinute()), String.format("%02d", time.getSecond())); }//from w ww .ja v a2 s .co m }