Here you can find the source of Timestamp2DDMMYYYY(java.sql.Timestamp ts)
public static String Timestamp2DDMMYYYY(java.sql.Timestamp ts)
//package com.java2s; public class Main { public static String Timestamp2DDMMYYYY(java.sql.Timestamp ts) { if (ts == null) { return ""; } else {/* ww w .j av a 2 s . c o m*/ 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); } } } }