Java tutorial
import java.sql.Timestamp; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Util { public static Timestamp formatTimestamp(Timestamp datetime) { try { DateFormat formatter; String dateFormat = datetime.toString(); System.out.println("Truoc:" + datetime); formatter = new SimpleDateFormat("dd/MM/yyyy"); Date date = (Date) formatter.parse(dateFormat); java.sql.Timestamp timeStampDate = new Timestamp(date.getTime()); System.out.println("Sau:" + timeStampDate); return timeStampDate; } catch (ParseException e) { System.out.println("Exception :" + e); return null; } } }