简体   繁体   中英

SQL Server datetime rounding

According to MSDN "Rounding of datetime Fractional Second Precision" it should truncate the following Date when saving into a datetime column:

new DateTime(635180453197748530L)  //22 October 2013 13:28:39.7748530
// write to SQL server and re-read it
// result should be = 6351804531977 3 0000L

However, it is reproducible 6351804531977 7 0000L . Is this a bug or do I have any problems in my understanding of the algorithm?

(we use Entity Framework for read/write to DB)

有时在我向数据库写一个日期时间之前,我把它转换为SqlDateTime,我发现它在舍入/截断方面比直接将CLR数据类型直接写入数据库产生了更多可预测的结果。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM