Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time.Time 读出时间差8小时,有办法统一处理吗? #123

Closed
15951836388 opened this issue Nov 8, 2020 · 8 comments
Closed

time.Time 读出时间差8小时,有办法统一处理吗? #123

15951836388 opened this issue Nov 8, 2020 · 8 comments
Labels
enhancement New feature or request

Comments

@15951836388
Copy link

15951836388 commented Nov 8, 2020

time.Time 读出时间差8小时,有办法统一处理吗

@jiangz222
Copy link
Collaborator

@15951836388
你需要贴一下你的最简单的测试代码,以及提供一下qmgo版本号

@jiangz222 jiangz222 added the question Further information is requested label Nov 9, 2020
@15951836388 15951836388 changed the title time.Time 读写和正常时间不同 time.Time 读出时间差8小时,有办法统一处理吗? Nov 9, 2020
@15951836388
Copy link
Author

之前说错了,time.Time ,读写 没问题。 只是再读出来,差8小时。希望读出来和写进去的值一样,有办法吗?

@jiangz222 jiangz222 added enhancement New feature or request and removed question Further information is requested labels Nov 9, 2020
@xen0n
Copy link
Contributor

xen0n commented Nov 18, 2020

时区问题,自己 t.In(time.Local) 这种方法处理一下可行否?

@xen0n
Copy link
Contributor

xen0n commented Nov 27, 2020

@15951836388 有后续么?

数据库查询统一返回 UTC 可以适应各种场景(归根结底时区这件事情,业务层是应当感知的),这也是 globalsign/mgo 做这个更改 的原因。如果可以解决你的问题最好。

@15951836388
Copy link
Author

没有解决。存进去的是什么,读出来的就应该是什么。

如果一个很复杂的角色对象数据,在业务层每次都要额外处理,心里负担,也是不太适合的。还是希望能有办法统一处理。

@jiangz222
Copy link
Collaborator

遵循MongoDB官方driver和 globalsign/mgo 行为,我们暂时不对时区做处理了,保持UTC

@ghost
Copy link

ghost commented Jun 7, 2024

@15951836388 有后续么?

数据库查询统一返回 UTC 可以适应各种场景(归根结底时区这件事情,业务层是应当感知的),这也是 globalsign/mgo 做这个更改 的原因。如果可以解决你的问题最好。

国情不一样吧. 国内的谁看utc时间. 如果只面对国内的业务, 再弄个utc就没必要了.

@xen0n
Copy link
Contributor

xen0n commented Jun 7, 2024

如果只面对国内的业务

后续万一业务发生扩展,而系统没有提前「麻烦」一点,那会有得好受,不要问我(们)怎么知道的 ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants