Here you can find the source of getTime(java.util.Date date)
public static String getTime(java.util.Date date)
//package com.java2s; public class Main { public static String getTime(java.util.Date date) { return format(date, "HH:mm:ss"); }//from w w w. j a v a 2 s .c o m public static String format(java.util.Date date, String format) { String result = ""; try { if (date != null) { java.text.DateFormat df = new java.text.SimpleDateFormat(format); result = df.format(date); } } catch (Exception e) { } return result; } public static String format(java.util.Date date) { if (date == null) { return ""; } return format(date, "yyyy/MM/dd"); } }