Here you can find the source of toTime(Date... date)
public static String toTime(Date... date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String FORMAT_2 = "HH:mm:ss"; public static String toTime(Date... date) { SimpleDateFormat simple = new SimpleDateFormat(FORMAT_2); if (date.length > 0) { return simple.format(date[0]); }/* w ww . j a v a 2 s. c o m*/ return simple.format(new Date()); } }