What is the internal representation of datetime in sql server?

It’s stored as an 8 byte field, capable of a range from 1753-01-01 through 9999-12-31, accurate to 0.00333 seconds.

The details are supposedly opaque, but most resources (1), (2) that I’ve found on the web state the following:

The first 4 bytes store the number of days since SQL Server’s epoch (1st Jan 1900) and that the second 4 bytes stores the number of ticks after midnight, where a “tick” is 3.3 milliseconds.

The first four bytes are signed (can be positive or negative), which explains why dates earlier than the epoch can be represented.

Leave a Comment