当前位置:网站首页>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())
}
}
边栏推荐
- Basic number theory - fast power
- Speech recognition learning summary
- Yolov4 target detection backbone
- One dimensional vector transpose point multiplication np dot
- Basic number theory -- Euler function
- How to manage the performance of R & D team?
- IT冷知识(更新ing~)
- Classification of plastic surgery: short in long long long
- location search 属性获取登录用户名
- Halcon Chinese character recognition
猜你喜欢
随机推荐
Mathematical modeling: factor analysis
js异步错误处理
轮子1:QCustomPlot初始化模板
kubeadm系列-00-overview
Business modeling of software model | vision
Digital analog 2: integer programming
[daily training -- Tencent selected 50] 557 Reverse word III in string
Wheel 1:qcustomplot initialization template
Array,Date,String 对象方法
猜谜语啦(8)
JS asynchronous error handling
资源变现小程序添加折扣充值和折扣影票插件
Explore the authentication mechanism of StarUML
Business modeling of software model | object modeling
Hello everyone, welcome to my CSDN blog!
[daiy4] jz32 print binary tree from top to bottom
[牛客网刷题 Day4] JZ32 从上往下打印二叉树
Meta标签详解
Low code platform | apaas platform construction analysis
C# LINQ源码分析之Count