一行搞定
`public static String stampToDate(int s){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(new Date(new Long(s)*1000));
}`
拆解
public static String stampToDate(int s){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long lt = new Long(s);
Date date = new Date(lt*1000);
String res = simpleDateFormat.format(date);
return res;
}