//timestamp 转Date 字符串
public static String getDateStringByTimeSTamp(Long timeStamp){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 秒级别的是要乘以1000,毫秒级别就不需要了
return sdf.format(new Date(timeStamp*1000));
}
//timestamp 转Date 字符串
public static String TimeStamp2Date(Timestamp timestamp){
long timest = timestamp.getTime();//获取的是是毫秒
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateStr = sdf.format(new Date(timest));
return dateStr;
}