获取当前系统时间添加到对象中

我数据库中时间的类型是Timestamp

servlet中

Notice notice=new Notice();
notice.setTitle(title);
notice.setContext(context);
notice.setPublicer(name);
notice.setPublicerId(Integer.valueOf(id));

SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
String here=df.format(new Date());
Timestamp ts = Timestamp.valueOf(here);//类型转换

notice.setWriteDate(ts);