Here you can find the source of formatDateHour(Date date)
public static String formatDateHour(Date date)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String formatDateHour(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(date); }//from www . j a va 2s . co m public static String formatDateHour(Timestamp date) { if (date == null) { return ""; } SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); return sdf.format(date); } }