Here you can find the source of timestamptoStr(Timestamp time)
public static String timestamptoStr(Timestamp time)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final SimpleDateFormat yyyy_MM_dd = new SimpleDateFormat("yyyy-MM-dd"); public static String timestamptoStr(Timestamp time) { // Date date = null; // if (null != time) { // date = new Date(time.getTime()); // }/*from w w w . j a v a2s . co m*/ return date2Str(yyyy_MM_dd); } public static String date2Str(SimpleDateFormat date_sdf) { Date date = getDate(); if (null == date) { return null; } return date_sdf.format(date); } public static String date2Str(Date date, SimpleDateFormat date_sdf) { if (null == date) { return null; } return date_sdf.format(date); } public static Date getDate() { return new Date(); } public static Date getDate(long millis) { return new Date(millis); } public static String getDate(String format) { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } }