Here you can find the source of getDateTimeStr(Timestamp timestamp)
public static final String getDateTimeStr(Timestamp timestamp)
//package com.java2s; import java.sql.Timestamp; import java.util.Calendar; public class Main { public static final String getDateTimeStr(Timestamp timestamp) { if (timestamp == null) { return null; }//from www . j a v a 2 s .c o m Calendar cal = Calendar.getInstance(); cal.setTime(timestamp); return cal.get(Calendar.DAY_OF_MONTH) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR) + " " + getFixedTwoStr(cal.get(Calendar.HOUR_OF_DAY)) + ":" + getFixedTwoStr(cal.get(Calendar.MINUTE)); } public static String getFixedTwoStr(int i) { String fixedTwoStr = i + ""; if (i < 10) { fixedTwoStr = "0" + i; } return fixedTwoStr; } }