当前位置:网站首页>Golang foundation - the time data inserted by golang into MySQL is inconsistent with the local time
Golang foundation - the time data inserted by golang into MySQL is inconsistent with the local time
2022-07-05 08:50:00 【The hunter is eating meat】
Problem description
golang towards mysql When inserting the data of the time field , The time value before insertion is correct , After inserting , In the database Time value Than Time value before insertion Less 8 Hours .
analysis
Default time zone and Caused by inconsistent local time zones .
analytic method
database URL Add... After configuration parseTime=true&loc=Local Parameters can be solved .
func init() {
Db, err = sql.Open("mysql", "root:[email protected](localhost:3306)/testDB?parseTime=true&loc=Local")
if err != nil {
panic(err.Error())
}
}
边栏推荐
- Business modeling of software model | vision
- Cmder of win artifact
- C language data type replacement
- 整形的分类:short in long longlong
- Use and programming method of ros-8 parameters
- Tips 1: Web video playback code
- 皮尔森相关系数
- Infix expression evaluation
- Basic number theory - fast power
- An enterprise information integration system
猜你喜欢

Illustration of eight classic pointer written test questions

Count of C # LINQ source code analysis

Guess riddles (7)

猜谜语啦(8)

Mathematical modeling: factor analysis

Programming implementation of ROS learning 2 publisher node

Halcon shape_ trans

Xrosstools tool installation for X-Series

Shift operation of complement

How apaas is applied in different organizational structures
随机推荐
C language data type replacement
Low code platform | apaas platform construction analysis
猜谜语啦(5)
Ros-11 common visualization tools
我从技术到产品经理的几点体会
EA introduction notes
Business modeling of software model | object modeling
猜谜语啦(3)
Programming implementation of ROS learning 2 publisher node
Meta标签详解
Digital analog 1: linear programming
Apaas platform of TOP10 abroad
Tips 1: Web video playback code
Digital analog 2: integer programming
Typescript hands-on tutorial, easy to understand
Halcon clolor_ pieces. Hedv: classifier_ Color recognition
Programming implementation of ROS learning 5-client node
How many checks does kubedm series-01-preflight have
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding
[daiy4] copy of JZ35 complex linked list