2.2.5.5.1.8 Dates and Times

smalldatetime is represented in the following sequence:

  • One 2-byte unsigned integer that represents the number of days since January 1, 1900.

  • One 2-byte unsigned integer that represents the number of minutes elapsed since 12 AM that day.

datetime is represented in the following sequence:

  • One 4-byte signed integer that represents the number of days since January 1, 1900. Negative numbers are allowed to represent dates since January 1, 1753.

  • One 4-byte unsigned integer that represents the number of one three-hundredths of a second (300 counts per second) elapsed since 12 AM that day.

date is represented as one 3-byte unsigned integer that represents the number of days since January 1, year 1.

time(n) is represented as one unsigned integer that represents the number of 10-n second increments since 12 AM within a day. The length, in bytes, of that integer depends on the scale n as follows:

  • 3 bytes if 0 <= n < = 2.

  • 4 bytes if 3 <= n < = 4.

  • 5 bytes if 5 <= n < = 7.

datetime2(n) is represented as a concatenation of time(n) followed by date as specified above.

datetimeoffset(n) is represented as a concatenation of datetime2(n) followed by one 2-byte signed integer that represents the time zone offset as the number of minutes from UTC. The time zone offset MUST be between -840 and 840.