Here you can find the source of getTimeByDate(Date date, String timeFormat)
public static String getTimeByDate(Date date, String timeFormat)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String getTimeByDate(Date date) { return getTimeByDate(date, null); }// w w w. j av a2 s.c o m public static String getTimeByDate(Date date, String timeFormat) { if (date == null) return null; if (timeFormat == null) { timeFormat = "MM/dd/yyy hh:mm:ss"; } return new SimpleDateFormat(timeFormat).format(date); } }