go中time.Time使用Insert和Exec插入的结果时区不同 #1770
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#1770
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
go结构体字段类型为 time.Time的时候,使用xorm的 Insert方法和 Exec方法写入数据,得到的时区不一样
表结构
代码
写入结果,Insert是+8时区, Exec变成了0时区
| ID | PubDate | PubTime1 | PubTime2 |
|------+------------+---------------------+---------------------|
| 1 | 2020-08-24 | 2020-08-24 16:30:16 | 2020-08-24 16:30:16 |
| 2 | 2020-08-24 | 2020-08-24 08:30:17 | 2020-08-24 08:30:17