Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odbc_result::as_double(date) should use UTC timezone #295

merged 4 commits into from Oct 8, 2019


Copy link

shrektan commented Aug 26, 2019

Closes #293

It's because the user timezone info on date is meaningless. Converting to the user timezone then extracting the date part will leading to one-day leap if the timezone is UTC+n, like Asia/Shanghai, or "Europe/Berlin".

This PR will address this issue.


(Before this PR, the result is "2018-12-31")

con <- DBI::dbConnect(
  server = '#hide#', database = '#hide#', uid = '#hide#', pwd = '#hide#',
  encoding = 'GB2312', driver = '{SQL Server Native Client 11.0}', port = 1433,
  timezone = 'Asia/Shanghai'
out <- DBI::dbGetQuery(con, "select cast('2019-01-01' as date) as aaa")
#> 'data.frame':    1 obs. of  1 variable:
#>  $ aaa: Date, format: "2019-01-01"

Created on 2019-08-26 by the reprex package (v0.2.1)


This comment has been minimized.

Copy link

jimhester commented Oct 8, 2019

Can you please add a bullet to NEWS? It should briefly describe the change and end with (@yourname, #issuenumber), then I can merge this.


This comment has been minimized.

Copy link
Contributor Author

shrektan commented Oct 8, 2019

I've added one item to NEWS. Thanks.

shrektan and others added 2 commits Oct 8, 2019
@jimhester jimhester merged commit 4ed9ee8 into r-dbi:master Oct 8, 2019
1 check was pending
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress

This comment has been minimized.

Copy link

jimhester commented Oct 8, 2019


@shrektan shrektan deleted the shrektan:fix293 branch Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.