首页 > 解决方案 > postgresql 获取时间戳列作为 zonedatetime

问题描述

我想TIMESTAMP WITH TIMEZONE使用 Spring-Boot获取类型的 postgresql 表记录JdbcTemplate

ZonedDateTime在获取时间戳列作为 Java 8 的ie ( queryForObject(myQuery, ZonedDateTime.class))时出现以下错误

影响行号 0 和列类型 'timestamptz' 的类型不匹配:

值 [2018-06-26 18:19:31.313733] 的类型为 [java.sql.Timestamp] 并且

无法转换为所需类型 [java.time.ZonedDateTime]

如何解决这个问题?

标签: postgresqlspring-bootjdbctemplate

解决方案


推荐阅读