Name
DATE( )
Synopsis
DATE(date
)
This function returns the date from a given string. This function is available as of Version 4.1.1 of MySQL.
SELECT appointment, DATE(appointment) FROM appointments WHERE client_id = '8639' LIMIT 1; +---------------------+-------------------+ | appointment | DATE(appointment) | +---------------------+-------------------+ | 2005-01-11 14:11:43 | 2005-01-11 | +---------------------+-------------------+
In this SQL statement, the value of
the appointment column, which is a
DATETIME
type column, is shown first. The second
field is the date extracted by the function from the same column.
Get MySQL in a Nutshell 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.