We will be seeing about the date and time data types.
- This one is used to store dates in YYYY-MM-DD between 1000-01-01 and 9999-12-31.
- January 1st, 2022 would be stored as 2022-01-01.
- This one is used to store data and time combinations in YYYY-MM-DD HH:MM:SS format between 1000-01-01 00:00:00 and 9999-12-31 22:22:11.
- 3:30 in the night on January 1st, 2022 would be stored as 2022-01-01 03:30:01.
- This one is used to store the number of seconds since the Unix epoch ('1970-01-01 00:00:00' UTC). Format: YYYY-MM-DD hh:mm:ss.
- The range is from 1970-01-01 00:00:01 UTC to 2038-01-09 UTC.
- Automatic initialization and updating to the current date and time can also be specified using DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP in the column definition.
- This one is a time format hh:mm:ss used to store time.
- The range is from '-838:59:59' to '838:59:59'.
- This one is used to store the year in a four-digit format.
- Only allowed in precisely four digits.
- 1901 to 2155 and also 0000 is the range.