Here you can find the source of formatDateToHours(Date time)
public static String formatDateToHours(Date time)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatDateToHours(Date time) { SimpleDateFormat formatter; formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String ctime = formatter.format(time); return ctime; }/*from www. j a v a2 s . c o m*/ }