Here you can find the source of toStringHour(int hours, int minutes, int seconds, int millis)
public static String toStringHour(int hours, int minutes, int seconds, int millis)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy - HH:mm:ss"); public static String toStringHour(int hours, int minutes, int seconds, int millis) { return String.format("%02d:%02d:%02d.%03d", hours, minutes, seconds, millis); }/*from ww w .j ava 2 s .c o m*/ public static synchronized String format(Date date) { if (date == null) { return null; } return dateFormat.format(date); } public static synchronized String format(Calendar calendar) { if (calendar == null) { return null; } return dateFormat.format(calendar.getTime()); } }