EF5 Beta1 DateTime comparison
-
10-12-2019 - |
Question
I am generating some test data for dates by using a random amount of ticks, but the date i put in seems to have a higher precision than the one I get back. Is this an issue with EF5 or is this something to do with the DateTime vs DateTime2 column types.
EG
Ticks from my generated time: 634074312268196992
Ticks from that time once stored/retrieved via EF: 634074312268200000
Solution
Since you mentioned that there are two date types involved then probably the problem is because datetime
has less precision then datetime2
date 2007-05-08
smalldatetime 2007-05-08 12:35:00
datetime 2007-05-08 12:35:29.123
datetime2 2007-05-08 12:35:29. 1234567
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow