DATE, DATETIME, and TIMESTAMP types

This section describes the most commonly used MySQL date and time data types: DATE, DATETIME, and TIMESTAMP. This section explains the similarities and differences between these data types.

The DATE data type is suitable when the values we wish to store have a date part, but the time part is missing. The standard MySQL date format is YYYY-MM-DD. The date values are retrieved and displayed in the standard format unless DATE functions are applied. The MySQL supported range of values is 1000-01-01 to 9999-12-31. Supported, here, means the values may work, but there is no guarantee. The same is the case for the DATETIME data type.

The DATETIME data type is suitable for values containing date and time parts. ...

Get MySQL 8 Administrator's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.