I was trying to debug some DateTime.Now in a C# project and while debugging I found this.
In your Sql Management Studio, type this:
The 916 becomes 917. Why does my millisecond get screwed?
select convert(datetime, '2007-06-29 15:22:31:921') -- prints 2007-06-29 15:22:31.920
select convert(datetime, '2007-06-29 15:22:31:916') -- print 2007-06-29 15:22:31.917
That is because of the precision of the datetime data type 1/300 of a second. Check BOL for more info about datetime data type.
select convert(datetime, '2007-06-29 15:22:31:998')
go
AMB
No comments:
Post a Comment