当前位置:网站首页>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())
}
}
边栏推荐
- Pytorch entry record
- Arduino+a4988 control stepper motor
- Programming implementation of ROS learning 6 -service node
- 319. 灯泡开关
- Task failed task_ 1641530057069_ 0002_ m_ 000000
- Numpy pit: after the addition of dimension (n, 1) and dimension (n,) array, the dimension becomes (n, n)
- C [essential skills] use of configurationmanager class (use of file app.config)
- Solutions of ordinary differential equations (2) examples
- 深度学习模型与湿实验的结合,有望用于代谢通量分析
- How to manage the performance of R & D team?
猜你喜欢
Classification of plastic surgery: short in long long long
Halcon snap, get the area and position of coins
猜谜语啦(5)
[Niuke brush questions day4] jz55 depth of binary tree
[牛客网刷题 Day4] JZ35 复杂链表的复制
Mathematical modeling: factor analysis
整形的分类:short in long longlong
Ros-10 roslaunch summary
L298N module use
Guess riddles (9)
随机推荐
ROS learning 1- create workspaces and function packs
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding
Halcon color recognition_ fuses. hdev:classify fuses by color
[matlab] matlab reads and writes Excel
TF coordinate transformation of common components of ros-9 ROS
Guess riddles (3)
Numpy 小坑:维度 (n, 1) 和 维度 (n, ) 数组相加运算后维度变为 (n, n)
使用arm Neon操作,提高内存拷贝速度
An enterprise information integration system
Old Wang's esp8266 and old Wu's ws2818 light strip
Guess riddles (142)
Typescript hands-on tutorial, easy to understand
EA introduction notes
多元线性回归(sklearn法)
287. Looking for repeats - fast and slow pointer
Task failed task_ 1641530057069_ 0002_ m_ 000000
Digital analog 1: linear programming
Halcon shape_ trans
Halcon snap, get the area and position of coins
Business modeling | process of software model