Skip to content

Commit

Permalink
use server timzone of for datetime and datetime64 of they don't have …
Browse files Browse the repository at this point in the history
…timezone (#14)
  • Loading branch information
vahid-sohrabloo committed May 5, 2022
1 parent 073bab2 commit ed65dff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions select_stmt.go
Expand Up @@ -249,6 +249,8 @@ func (s *selectStmt) columnByType(columns *[]column.Column, chType []byte, nulla
if len(params) > 0 && len(params[0]) >= 3 {
if loc, err := time.LoadLocation(string(params[0][1 : len(params[0])-1])); err == nil {
col.SetLocation(loc)
} else if loc, err := time.LoadLocation(s.conn.serverInfo.Timezone); err == nil {
col.SetLocation(loc)
}
}
*columns = append(*columns, col)
Expand All @@ -265,6 +267,8 @@ func (s *selectStmt) columnByType(columns *[]column.Column, chType []byte, nulla
if len(params) > 1 && len(params[1]) >= 3 {
if loc, err := time.LoadLocation(string(params[1][1 : len(params[1])-1])); err == nil {
col.SetLocation(loc)
} else if loc, err := time.LoadLocation(s.conn.serverInfo.Timezone); err == nil {
col.SetLocation(loc)
}
}
*columns = append(*columns, col)
Expand Down

0 comments on commit ed65dff

Please sign in to comment.