我通过使用随机的滴答量来为日期生成一些测试数据,但我所输入的日期似乎具有比我回来的更高的精度。这是ef5的问题,也是与DateTime VS DateTime2列类型有关的问题。

,例如

从我所生成的时间刻度:634074312268196992

从该时间刻度,一旦通过EF存储/检索:634074312268200000

有帮助吗?

解决方案

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top