golang解析mongodb中的ISODate类型
在golang中可以使用time.Time数据类型来保存mongodb中的ISODate时间。gtype Model struct { uploadDate time.Time `bson:"uploadDate"` } m := Model{} if err := c.Find(nil).Select({"_id": 0, "uploadDate": 1}).One(&m); err != nil { fmt.Printf("failed to find date, error %s\n", err) os.Exit(1) } fmt.Printf("%+v\n", m)从输出中可以看到golang输出的时间格式是CST时区,golang在处理的过程中将ISO时间转换成了CST时间,从时间...阅读全文