-
Notifications
You must be signed in to change notification settings - Fork 63
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
Error when converting SQLTimestamp with milliseconds to DateTime #184
Comments
The issue seems to be that milliseconds are only defined on the range 0-999 (see Dates/src/types.jl#L193) One option is to truncate the extra precision using ODBC
using Base.Dates
val = ODBC.API.SQLTimestamp(2018, 2, 12, 0, 26, 49, 537000000)
DateTime(x::ODBC.API.SQLTimestamp) = Base.Dates.DateTime(x.year, x.month, x.day, x.hour, x.minute, x.second, div(x.fraction, 1000000))
DateTime(val) |
You can simplify your logic if you change |
Does anyone know what is the reason behind having the These structs have a lot of missing methods and it would seem a lot more natural to return the Julia Base.Dates types rather than these custom ones... |
As of #263 , we now return Base Julia structs for query resultset columns. |
Hi there,
I am extracting some data from MS SQL Server.
When retrieving datetime columns the resulting DataFrame column has type
ODBC.API.SQLTimestamp
, OK so far.I try to convert the column to
DateTime
, and it works if the value doesn't have milliseconds.If it has milliseconds I have to convert it to a
String
first, which is hacky.Example below.
The text was updated successfully, but these errors were encountered: