数据库中存储时间格式为2013-11-11 11:08:08,现在要从ResultSet中取出时间,当然是要包含年月日时分秒的,发现
所以正确取得时间格式为2013-11-11 11:08:08方式如下:
Date time1=new Date(rs.getTimestamp("pub_time").getTime());//java.util.Date
SimpleDateFormat formattime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String pubtime=formatime.format(time1);
|
|