使用jdbc查询数据库获取结果集
new Date(rs.getTimestamp(“OCCUR_DATE”).getTime())
获取时间戳,然后转换成Date会存在时间差问题
如果是mysql数据库可以使用
useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8解决
也可以直接使用rs.getString(“OCCUR_DATE”),然后使用SimpleDateFormat将字符串时间转成Date类型,不会存在时区问题