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

Go: Format timestamp to default postgres format

如何制作时间戳格式:

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 加了小数。