You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/06/18 02:04:25 UTC

[GitHub] [dubbo-go] PL-Joe opened a new issue, #1938: 查询"timestamp"时间类型,时区丢失问题

PL-Joe opened a new issue, #1938:
URL: https://github.com/apache/dubbo-go/issues/1938

   **大背景:**  java改go
   
   数据库:PostgreSQL 时间类型"timestamp", 存储为当地时间(没有带时区, 且没有做时区偏移处理) : 数据如下
   ![image](https://user-images.githubusercontent.com/107296968/173984347-d25d8c7c-b66c-4676-ac62-447524249585.png)
   
   **实现:**  java接口不变, impl由go提供。java使用Date,go使用time.Time接收时间类型。
   
   **问题:** gorm查询出来的时间是带时区的结构:‘2022-06-15 05:15:28.367 +0000’
   ![image](https://user-images.githubusercontent.com/107296968/173982024-453fdaa1-f855-4cee-a29d-71681601193a.png)
   
   在go time.Time严谨的结构来看,原先由java程序存储下来的时间字段值就显得"‘不准确"或者说"不正确"。
   将时间字段值 ‘2022-06-15 15:08:00.367 +0000’ 传递给java程序端时,java接收到的字段值是 : “2022-06-15 23:08:00”,自动根据当地的时区做了时区偏移,加了8个小时 :
   ![image](https://user-images.githubusercontent.com/107296968/173983074-86e5e09f-adcd-49cd-8c1d-6f7826d2cc6b.png)
   
   **提问 :** 有没有办法在go端处理时区的问题?(去掉时区,或者给时间类型字段设置为当地的时区)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] LaurenceLiZhixin commented on issue #1938: 查询"timestamp"时间类型,时区丢失问题

Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin commented on issue #1938:
URL: https://github.com/apache/dubbo-go/issues/1938#issuecomment-1165559988

   这个问题看上去和框架没有直接关系,可以查阅一下go的时区管理相关的资料 @PL-Joe 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] AlexStocks closed issue #1938: 查询"timestamp"时间类型,时区丢失问题

Posted by GitBox <gi...@apache.org>.
AlexStocks closed issue #1938: 查询"timestamp"时间类型,时区丢失问题
URL: https://github.com/apache/dubbo-go/issues/1938


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org