Skip to content

Commit

Permalink
Update MySQL TimeZone
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmmdriz committed Jun 25, 2024
1 parent 64ae6bd commit a0fca2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ func ConnectDB(config Config) *gorm.DB {
if err != nil {
panic(err)
}
time.Local = loc

// Creating the DSN with loc parameter
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=%s",
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local",
config.DB_USERNAME,
config.DB_PASSWORD,
config.DB_HOST,
config.DB_PORT,
config.DB_NAME,
loc.String(),
)
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
if err != nil {
Expand Down

0 comments on commit a0fca2e

Please sign in to comment.