go mongo 时区问题

 

 

 

https://zhuanlan.zhihu.com/p/479189070

 

 

 

func main() {

    sh, err := time.LoadLocation("Asia/Shanghai") //设置时区
    if err != nil {
        sh = time.FixedZone("CST", 8*3600) //替换上海时区
    }

    time.Local = sh

    if beego.BConfig.RunMode == "dev" {
        beego.BConfig.WebConfig.DirectoryIndex = true
        beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger"
    }
    beego.Run()
}

 

posted @ 2022-11-01 15:25  AngDH  阅读(113)  评论(0编辑  收藏  举报