gpt4 book ai didi

postgresql - Go:将时间戳格式化为默认的 postgres 格式

转载 作者:行者123 更新时间:2023-11-29 14:20:45 25 4
gpt4 key购买 nike

如何制作时间戳格式:

2015-01-25T22:22:46+08:00

看起来像这样

2015-01-25T22:22:46.923331Z

为了获得第一种格式,我使用了

time.Now().Format(time.RFC3339)

第二种格式是我试图复制的默认 postgres 格式。谢谢!

最佳答案

改为使用 "2006-01-02T15:04:05.000000Z" 作为格式。它只是添加了小数的 RFC3339

关于postgresql - Go:将时间戳格式化为默认的 postgres 格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28137495/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com