如何从“无时区的时间戳”字段收集到无时区的Java时间戳
来源:爱站网时间:2021-09-23编辑:网友分享
我的Jooq查询:dslContext.select(timeInterval,ifnull(avg(field(FieldName.AVERAGE,Double.class)).cast(Double.class),0.0))....
问题描述
我的Jooq查询:
dslContext.select(
timeInterval,
ifnull(avg(field(FieldName.AVERAGE, Double.class))
.cast(Double.class), 0.0))
.from(channelTimebucketQuery)
.groupBy(timeInterval)
.orderBy(timeInterval)
.collect(Collectors.toMap(Record2::component1, Record2::component2));
但是我的Profiler说它应该返回一个没有时区的时间戳。
select pg_typeof(time_bucket) from (
select "alias_67258973"."time_bucket", coalesce(cast(avg(average) as double precision), 0.0) from (select "public"."time_bucket_gapfill"("bucket_width" := cast("public"."create_interval"("seconds" := 43200) as "pg_catalog"."interval"), "ts" := cast("public"."testTable"."time" as timestamp), "start" := cast(null as timestamp), "finish" := cast(null as timestamp)) as "time_bucket", avg("public"."testTable"."average") as "average" from "testTable" where ("public"."testTable"."device" in ('702088' ) and "public"."testTable"."time" >= timestamp '2020-02-10 13:57:28.2212375' and "public"."testTable"."time"
时区来自哪里?我如何将时区设置为+ 0000
思路:
SQL类型
TIMESTAMP WITHOUT TIME ZONE
(或仅TIMESTAMP
)的默认JDBC类型是java.sql.Timestamp
。出于历史原因,我们都感到遗憾,java.sql.Timestamp
扩展了java.util.Date
,该模型通过将您的[[JVM