SQL Tutorial: Date and Time Data Types

The date and time data types described in below Table

Data type Format Range Storage size
time hh:mm:ss[.nnnnnnn] 00:00:00.0000000 through 23:59:59.9999999 3 to 5 bytes
date YYYY-MM-DD 0001-01-01 through 9999-12-31 3 bytes
smalldatetime YYYY-MM-DD hh:mm:ss 1900-01-01 through 2079-06-06 4 bytes
datetime YYYY-MM-DD hh:mm:ss[.nnn] 1753-01-01 through 9999-12-31 8 bytes
datetime2 YYYY-MM-DD hh:mm:ss[.nnnnnnn] 0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999 6 to 8 bytes
datetimeoffset YYYY-MM-DD hh:mm:ss[.nnnnnnn] [+|-]hh:mm 0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999 (UTC) 8 to 10 bytes

For example: Employee table with datetime data type

employee table