SQL DATE and TIME Data Types in SQL Server

Last modified date:

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

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Category: SQL Tutorials Tags:

About Ing. Jan Zedníček - BI Developer, Finance controller

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.