MySQL has several data types for representing dates and times, and many functions for operating on them. MySQL stores dates and times in specific formats, and it’s important to understand them to avoid surprises in results from manipulating temporal data. This chapter covers the following aspects of working with date and time values in MySQL:
MySQL provides several temporal data types to choose from when you create tables. Knowing their properties enables you to choose them appropriately.
MySQL displays temporal values using specific formats by default. You can produce other formats by using the appropriate functions.
The server interprets
TIMESTAMP values in the client’s current time zone, not its own. Clients
in different time zones should set their zone so that the server can
values for them.
MySQL provides functions that return the date and time. These are useful for applications that must know these values or need to calculate other temporal values in relation to them.
DATETIME data types have special properties that enable you to record
row-creation and last-modification times automatically.
You can split date and time values when you need ...