Name
CURDATE( )
Synopsis
CURDATE( )
This function returns the current
system date in yyyy-mm-dd format. It will return
the date in a yyyymmdd format if
it’s used as part of a numeric calculation (see
example). You can use the function in SELECT
statements as shown here, in INSERT
and
UPDATE
statements to set a value, or in a
WHERE
clause. CURDATE( )
is
synonymous with CURRENT_DATE
; see its definition
for more details.
SELECT CURDATE( ) AS Today, CURDATE( ) + 1 AS Tomorrow; +------------+----------+ | Today | Tomorrow | +------------+----------+ | 2005-01-15 | 20050116 | +------------+----------+
Because the second use of the function involves a numeric calculation, tomorrow’s date is displayed without dashes.
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.