
Your data, our passion.
Snack-Sized Data Basics
Data Types - Date & Time
Date and time data types store, you guessed it, date and time!

There are different types of date and time data types used in SQL. Here are a few:
-
DATE stores date values in the following format: YYYY-MM-DD.
-
Example: 2024-03-02.
-
-
TIME stores time values in the following format: HH:MM:SS.
-
Example: 14:30:00.
-
-
DATETIME stores both date and time values in the following format: YYYY-MM-DD HH:MM:SS.
-
Example: 2024-03-02 14:30:00.
-
-
TIMESTAMP stores date and time with time zone information in the following format: YYYY-MM-DD HH:MM:SS UTC.
-
Example: 2024-03-02 14:30:00 UTC.
-
You can extract different components from date and time values. For example, from a DATETIME value of 2024-03-02 14:30:00, you can extract the date 2024-03-02, the time 14:30:00, the year 2024, the month 03, the hour 14, and so on.
DATETIME and TIMESTAMP are more commonly used than DATE and TIME because they store both the date and time together, making them more versatile.