SQL DATE and TIME Data Types in SQL Server

This article follows post in which I offered overview of Data types in SQL Server (more in SQL Data types – Overview ). You can find list of all system data types in it. We can now focus on another category from mentioned overview of t-sql Date and time data types.

Date data types specification will be shorter than previous article on numeral ones since there is not much to write about. It is simple.

SQL Date and Time Data Types

Data Type Range of Values Format Size
DATE 0001-01-01 to 9999-12-31 YYYY-MM-DD 3 Bytes
TIME 00:00:00.0000000 to 23:59:59.9999999 hh:mm:ss[.nnnnnnn] 3-5 Bytes
SMALLDATETIME 1900-01-01 to 2079-06-06 YYYY-MM-DD hh:mm:ss 4 Bytes
DATETIME 1753-01-01 to 9999-12-31 YYYY-MM-DD hh:mm:ss[.nnn] 8 Bytes
DATETIME2 0001-01-01 00:00:00.0000000 to 9999-12-31 23:59:59.9999999 YYYY-MM-DD hh:mm:ss[.nnnnnnn] 6-8 Bytes
DATETIMEOFFSET 0001-01-01 00:00:00.0000000 to 9999-12-31 23:59:59.9999999 (UTC) YYYY-MM-DD hh:mm:ss[.nnnnnnn] [+|-]hh:mm 8-10 Bytes

Things to point out:

  1. Data type DATETIMEOFFSET which enables user to obtain information on time zone. This might be the choice for globally focused databases
  2. DATETIME can hold dates all the way back to 1753
  3. SMALLDATETIME holds dates till 1900

More detailed information on date data types can be found on Microsoft web here

Rate this post
Category: SQL Tutorials

About Ing. Jan Zedníček - Data Engineer & Controlling

My name is Jan Zednicek, and I have been working as a freelance Data Engineer for roughly 10 years. During this time, I have been publishing case studies and technical guides on this website, targeting professionals, students, and enthusiasts interested in Data Engineering particularly on Microsoft technologies as well as corporate finance and reporting solutions. 🔥 If you found this article helpful, please share it or mention me on your website or Community forum

Leave a Reply

Your email address will not be published. Required fields are marked *