Here you can find the source of getDateString(java.sql.Timestamp ts)
public static String getDateString(java.sql.Timestamp ts)
//package com.java2s; public class Main { public static String getDateString(java.sql.Timestamp ts) { if (ts == null) { return ""; }//from w ww . ja v a 2 s .com return Timestamp2DDMMYYYY(ts); } public static String Timestamp2DDMMYYYY(java.sql.Timestamp ts) { if (ts == null) { return ""; } else { java.util.Calendar calendar = java.util.Calendar.getInstance(); calendar.setTime(new java.util.Date(ts.getTime())); String strTemp = Integer.toString(calendar.get(calendar.DAY_OF_MONTH)); if (calendar.get(calendar.DAY_OF_MONTH) < 10) { strTemp = "0" + strTemp; } if (calendar.get(calendar.MONTH) + 1 < 10) { return strTemp + "/0" + (calendar.get(calendar.MONTH) + 1) + "/" + calendar.get(calendar.YEAR); } else { return strTemp + "/" + (calendar.get(calendar.MONTH) + 1) + "/" + calendar.get(calendar.YEAR); } } } }