1.不要出现魔法值(数字),定义常量或者枚举
2.防止空指针
3.throws Exception() 表示上层必须try catch捕获
4. 创建new Timestamp(System.currentTimeMillis())
5. timestamp转string
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");标签:return,df,timestamp,代码,规范,笔记,SimpleDateFormat,new From: https://www.cnblogs.com/sjj123/p/16773118.html
if(timestamp==null){
return "";
}
return df.format(timestamp);