Here you can find the source of formatTime(Date d)
public static String formatTime(Date d)
//package com.java2s; import java.util.*; import java.text.SimpleDateFormat; public class Main { private static String TIME_FORMAT = "HH:mm:ss"; public static String formatTime(Calendar c) { if (c == null) return null; SimpleDateFormat df = new SimpleDateFormat(TIME_FORMAT); return df.format(c.getTime()); }//from ww w.j a v a 2 s.c o m public static String formatTime(Date d) { if (d == null) return null; SimpleDateFormat df = new SimpleDateFormat(TIME_FORMAT); return df.format(d); } }