之前用的mysql的timestamp感觉不太好
看了书上的用的date 方法其实都是一样要么用SimpleDateFormt要么直接上
普通日期显示
方法一:
model中定义个
private Date date
或者private Timestamp timestamp
逻辑处理部分直接用系统的时间
newKeyword.setCreateTime(new Date (System.currentTimeMillis()));
或者newKeyword.setCreateTime(new Timestamp(System.currentTimeMillis()));
方法二:
//这里的类型不一样xxx.format返回的是String
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
String date=sdf.format(new Date());