Functions that return dates

Functions that return dates Description Example

CURDATE

CURRENT_DATE

Returns today’s date

 

CURTIME

CURRENT_TIME

Returns the current time

 

CURTIMESTAMP

CURRENT_TIMESTAMP

Returns the current timestamp value

 

TIMESTAMPVAL

Converts a character string to a timestamp

TIMESTAMPVAL('2028-01-30 14:00:00') returns its timestamp value

DATE

TODAY

Returns today’s date

If today is 11/21/2028, DATE() returns 2028-11-21

DATEVAL

Converts a character string to a date

DATEVAL('2028-01-30') returns 2028-01-30

INTERVAL

Add or subtract an interval value of a specified unit type (YEAR, MONTH, DAY, HOUR, MINUTE, SECOND) to a date or time value

DATEVAL('2028-01-30') - INTERVAL 2 YEAR returns 2026-01-30

DATEVAL('2028-01-30') + INTERVAL 3 MONTH returns 2028-04-30

Notes 

  • The DATE() function is deprecated. Use the SQL standard CURRENT_DATE instead.

  • The INTERVAL function cannot be used in isolation. You must add or subtract to a date or time value in order to avoid an error.