Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 number of bytes to store a datetime variable

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-05-09 : 08:20:02
Oliver writes "How come datetime needs 4 bytes to store the number of days between 1.1.1753 and 31.12.999 and 4 bytes to store the number of milliseconds after midnight with accuracy of 3 milliseconds.
It seems that with 2^31 you can count much further, right ?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-05-09 : 08:23:38
I agree, but I couldn't tell you why they chose that. It probably has more to do with Sybase SQL Server (pre 7.0 SQL Server was based on Sybase), and changing the internal format would've caused too much aggravation.

There is a practical reason for choosing 1753, because the Common Era calendar cannot be standardized for dates prior to that year.

They were going to have a UTCDatetime type in SQL2005 which had a much greater range, but they had to drop it because of compatibility issues.
Go to Top of Page
   

- Advertisement -