Date data types in SQL

In this chapter you will learn:
What is date data type?
Types of date data type

What is date data type?

Sometimes we need to store the date value in our database records then the date data type used to store the date in the specific database or table. There are so many date data types by which we can store date in different format.

Data types Range Used to store Storage (Bytes)
datetime January 1, 1753, through December 31, 9999 Date and time data 8
smalldatetime January 1, 1900, through December 31, 2079 Date and time data 4
date January 1, 0001, through December 31, 9999 A.D. Date data 3
datetime2 January 1, 0001, through December 31, 9999 A.D. Date and time data 6 to 8
datetimeoffset January 1, 0001, through December 31, 9999 A.D. Time zone adware date and time data 10
time 00:00:00.0000000 through 23:59:59.9999999 Time data 5
timestamp Maximum storage size of 8 bytes Unique number in a database that is updated every time a rows that contains time stamp is inserted or updated 8
Year 1970 to 2069 Store year in two or four digit format

SUMMARY

All date data types are given in this chapter for your help to leran easily. In the next chapter all remaining data type of sql are given into other data types category.

More Articles

 

Share your thought