0

我在 golang 中使用 github.com/mongodb/mongo-go-driver 驱动程序我的代码结构:

type Document struct {
   CreatedAt time.Time `bson:"createdAt"`
}

当我插入一个文档时,它是作为 ISODate() 插入的,它看起来像这样:

{
    "createdAt" : ISODate("2019-06-12T08:55:45Z")
}

从代码中,当我收到文件时,他在 UTC 时区读取。我想在本地时区系统中转换日期。有什么办法可以用驱动程序做到这一点

4

0 回答 0