文章标题 原创 翻译 转载 文章内容 这个很明显是时区的问题,首先检查一下数据库连接的uri,是否包含如下参数: ``` parseTime=true&loc=Local ``` 重新连接数据库就可以了,如果还不行那你可能要看一下系统环境设置了。 [官方文档链接](https://github.com/go-sql-driver/mysql#parameters) ``` loc Type: string Valid Values: <escaped name> Default: UTC Sets the location for time.Time values (when using parseTime=true). "Local" sets the system's location. See time.LoadLocation for details. Note that this sets the location for time.Time values but does not change MySQL's time_zone setting. For that see the time_zone system variable, which can also be set as a DSN parameter. ``` 文章类别 Python Mobile Android Java Shell Life Database Bug Windows IOS Tools Boost Node.js Mac Product Tips C/C++ Golang Javascript React Qt MQ MongoDB Design Web Linux LLM ChatGPT RAG AI 提交