go-mssqldb icon indicating copy to clipboard operation
go-mssqldb copied to clipboard

The connection string support loc and parse time? About timezone problem

Open lamjack opened this issue 6 years ago • 3 comments

It's my connection string,

odbc:server=xxx;user id=xxx;password=xxx;port=1433;parseTime=true;loc=Asia/Shanghai;dial timeout=3;entrypt=false;TrustServerCertificate=true

and here is my code,

import (
	_ "github.com/denisenkom/go-mssqldb"
)

func main() {
	if MSSQLConn, err = sql.Open("mssql", connStr); err != nil {
		return err
	}
}

But all the time selected from db, the timezone is +0000 (Asia/Shanghai is +0800)? So it's supported parse time and loc parameters this driver?

Thanks.

lamjack avatar Jan 22 '19 03:01 lamjack

I found the problem in type.go, any time parser is used time.UTC, I have forked the project and coding something to add the time local config features, could I submit this PR?

lamjack avatar Jan 22 '19 06:01 lamjack

@lamjack 我遇到了同样的问题

sanrentai avatar Oct 12 '20 15:10 sanrentai

@lamjack github.com/microsoft/go-mssqldb is accepting PRs!

shueybubbles avatar Sep 09 '22 12:09 shueybubbles