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

dttm_cvt and tm_cvt do not work when subsecond value more accurate than milliseconds #75

Open
yorick-rp opened this issue Apr 26, 2018 · 0 comments

Comments

@yorick-rp
Copy link

When getting datetime data from SQL Server, the subsecond value has 7 digits. The code assumes there to be 6 or fewer digits.

To get this working, I truncated the subsecond value to the first 6 digits, so that it has millisecond values.

I changed the last line of dttm_cvt to be:
else: return datetime.datetime(int(x[0:4]),int(x[5:7]),int(x[8:10]),int(x[10:13]),int(x[14:16]),int(x[17:19]),int(x[20:].ljust(6,'0')[0:6]))

Similarly, I changed the last line of tm_cvt to be:
else: return datetime.time(int(x[0:2]),int(x[3:5]),int(x[6:8]),int(x[9:].ljust(6,'0')[0:6]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant