Date & Time Data Types
Data Type is an attribute that defines type of data of an object in the SQL Server. Each Table Column, Program Variable, Expression and Parameter must be defines with unique data types to optimize database operation in the SQL Server.
SQL Server deployed with Exact Numerics, Approximate, Numerics, Data and Time, Character Strings, Unicode Character String, Binary Strings and Other System Data Types. SQL Server can deploy with Alias Data Types that are based on the system supplied data types. SQL Server can deploy with User Defined Data Types that can form and execute through .NET Programming Language.
Date and Time |
Data Type |
Range |
Storage |
date |
0001-01-01 through 9999-12-31
January 1, 1 A.D. through December 31, 9999 A.D.
Default Format is YYYY-MM-DD
Default Value is 1900-01-01 |
3 Bytes, fixed |
datetime2 |
0001-01-01 through 9999-12-31
January 1,1 AD through December 31, 9999 AD
Default Format is
YYYY-MM-DD hh:mm:ss[.fractional seconds]
Default Value is
1900-01-01 00:00:00 |
6 Bytes for precisions less than 3;
7 Bytes for precisions 3 and 4.
All other precisions require 8 Bytes. |
datetime |
Date range January 1, 1753, through December 31, 9999
Time range 00:00:00 through 23:59:59.997
Default Format is Not applicable
Default Value is 1900-01-01 00:00:00 |
8 Bytes |
datetimeoffset |
Date range 0001-01-01 through 9999-12-31
January 1,1 A.D. through December 31, 9999 A.D.
Time range 00:00:00 through 23:59:59.9999999
datetimeoffset [ (fractional seconds precision) ]
Default Format is
(used for down-level client)
YYYY-MM-DD hh:mm:ss[.nnnnnnn]
[{+|-}hh:mm]
Default Value is 1900-01-01 00:00:00 00:00 |
10 Bytes, fixed is the default with the default of 100ns fractional second precision. |
smalldatetime |
Date range 1900-01-01 through 2079-06-06
Date range 1900-01-01 through 2079-06-06
January 1, 1900, through June 6, 2079
Time range 00:00:00 through 23:59:59
2007-05-09 23:59:59 will round to
2007-05-10 00:00:00
Default Format is Not applicable
Default Value is 1900-01-01 00:00:00 |
4 Bytes, fixed. |
Time |
00:00:00.0000000 through 23:59:59.9999999
Default Format is hh:mm:ss[.nnnnnnn]
Default Value is 00:00:00 |
5 Bytes, fixed, is the default with the default of 100ns fractional second precision. |
|