You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gqcn
added
bug
It is confirmed a bug, but don't worry, we'll handle it.
done
This issue is done, which may be release in next version.
labels
Jun 2, 2021
版本
go1.16
gf v1.15.6
场景
数据库使用pgsql,字段类型为timestamptz,数据内容例如: 2021-05-20 00:00:00+00
数据库时区为UTC,go服务时区为UTC+8
问题
查询结果,会忽略掉数据中的时区,直接保存为UTC+8时区。例如数据2021-05-20 00:00:00+00,查询结果为2021-05-20 00:00:00+08
查询如果包含gtime.Time类型的条件,会按照UTC+8格式化成时间字符串(2021-05-20 00:00:00)没有附加时区+08。
这时如果数据非UTC+8,就会按照数据本身的时区查询。 例如: 数据为 2021-05-20 00:00:00+00,查询条件 2021-05-20 00:00:00可以命中这条记录。
插入数据时,插入数据不带时区信息。例如数据库时区为UTC,程序时区UTC+8,插入数据2021-05-21 00:00:00+08,实际保存的数据是2021-05-21 00:00:00+00
The text was updated successfully, but these errors were encountered: