Here you can find the source of dateTime2str(java.sql.Date date)
static public String dateTime2str(java.sql.Date date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; public class Main { static public SimpleDateFormat MMddYYYY_HHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); static public String dateTime2str(java.sql.Date date) { if (date == null) return ""; try {/* www .ja va 2 s. c o m*/ return MMddYYYY_HHmmss.format(date); } catch (Exception e) { return ""; } } static public String dateTime2str(java.sql.Timestamp date) { if (date == null) return ""; try { return MMddYYYY_HHmmss.format(date); } catch (Exception e) { return ""; } } }