This section discusses the Date data type and guides you on using and operating the date values.
The DATE data type is used to store and insert date values.
💡 The date value is stored without the time zone.
The date type contains three components: year, month, and day. It’s represented in a 32-bit integer. Here is the breakdown:
- Day component: 5 bits store the number of days within a month. Its value is in the range <1, 31>.
- Month component: 4 bits store the month of the year. Its value is in the range <1, 12>.
- Year component: 23 bits store the number of years. It’s value is from range <0, 2^23 - 1>.
- YYYY - Four-digit year
- DD - One / two-digit day
- MM - One / two-digit month
In this example, we will create an emp_submission table that consists of candidate ID, candidate name, the submitted department, and a submission date with a DATE data type.
Create a table
Now that the data has been inserted, let’s execute the SELECT statement below:
Display the table
The following is the result of the SELECT query where the values in the sub_date column using a DATE data type:
Updated 11 May 2023
Did this page help you?