Here you can find the source of getTime(Date executionTime)
public static String getTime(Date executionTime)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getTime(Date executionTime) { SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); return formatter.format(executionTime); }// w w w . jav a 2 s . co m public static Date getTime(String timeInString) { DateFormat dateFormat = new SimpleDateFormat("hh:mm:ss"); Date date = null; try { date = dateFormat.parse(timeInString); // System.out.println("Date and Time: " + date); } catch (Exception e) { e.printStackTrace(); } return date; } }