Documentation Home
MySQL HeatWave User Guide
Related Documentation Download this Manual
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb

MySQL HeatWave User Guide  /  ...  /  Date and Time Functions

2.12.7 Date and Time Functions

The following table shows supported date and time functions. The VARLEN Support column identifies functions that support variable-length encoded string columns. See Section 2.7.1, “Encoding String Columns”.

Table 2.7 Date and Time Functions

Name VARLEN Support Description
ADDDATE() Add time values (intervals) to a date value
ADDTIME() Yes Add time
CONVERT_TZ() Convert from one time zone to another. Conversion of named time zones is not supported. For a workaround, see Section 2.16.3, “Functions and Operator Limitations”.
CURDATE() Return the current date
CURTIME() Return the current time
DATE() Yes Extract the date part of a date or datetime expression
DATE_ADD() Yes Add time values (intervals) to a date value
DATE_FORMAT() Yes Format date as specified
DATE_SUB() Subtract a time value (interval) from a date
DATEDIFF() Subtract two dates
DAY() Yes Synonym for DAYOFMONTH()
DAYNAME() Yes Return the name of the weekday
DAYOFMONTH() Yes Return the day of the month (0-31)
DAYOFWEEK() Return the weekday index of the argument
DAYOFYEAR() Yes Return the day of the year (1-366)
EXTRACT() Extract part of a date
FROM_DAYS() Convert a day number to a date. Supported as of MySQL 8.0.30.
FROM_UNIXTIME() Format Unix timestamp as a date
GET_FORMAT() Return a date format string. Supported as of MySQL 8.1.0.
HOUR() Yes Extract the hour
LAST_DAY() Yes Return the last day of the month for the argument
MAKEDATE() Create a date from the year and day of year. Supports FLOAT, DOUBLE, INTEGER, and YEAR type values.
MAKETIME() Create time from hour, minute, second. Supported as of MySQL 8.1.0.
MICROSECOND() Yes Return the microseconds from argument
MINUTE() Yes Return the minute from the argument
MONTH() Yes Return the month from the date passed
MONTHNAME() Yes Return the name of the month
NOW() Return the current date and time
PERIOD_ADD() Add a period to a year-month. Supported as of MySQL 8.1.0.
PERIOD_DIFF() Return the number of months between periods. Supported as of MySQL 8.1.0.
QUARTER() Yes Return the quarter from a date argument
SEC_TO_TIME() Converts seconds to 'HH:MM:SS' format. Supported as of MySQL 8.1.0.
SECOND() Return the second (0-59)
STR_TO_DATE() Yes Convert a string to a date
SUBDATE() Synonym for DATE_SUB() when invoked with three arguments. Supported as of MySQL 8.1.0.
SUBTIME() Yes Subtract times. Supported as of MySQL 8.1.0.
SYSDATE() Return the time at which the function executes. Supported as of MySQL 8.1.0.
TIME() Yes Extract the time portion of the expression passed
TIME_FORMAT() Yes Format as time.
TIME_TO_SEC() Return the argument converted to seconds
TIMEDIFF() Subtract time. Supported as of MySQL 8.1.0.
TIMESTAMP() Yes With a single argument, this function returns the date or datetime expression; with two arguments, the sum of the arguments
TIMESTAMPADD() Add an interval to a datetime expression
TIMESTAMPDIFF() Yes Subtract an interval from a datetime expression
TO_DAYS() Yes Return the date argument converted to days
TO_SECONDS() Yes Return the date or datetime argument converted to seconds since Year 0
UNIX_TIMESTAMP() Return a Unix timestamp
UTC_DATE() Return the current UTC date. Supported as of MySQL 8.1.0.
UTC_TIME() Return the current UTC time. Supported as of MySQL 8.1.0.
UTC_TIMESTAMP() Return the current UTC date and time. Supported as of MySQL 8.1.0.
WEEK() Yes Return the week number. Restrictions apply. See Section 2.16.3, “Functions and Operator Limitations”
WEEKDAY() Return the weekday index
WEEKOFYEAR() Return the calendar week of the date (1-53)
YEAR() Yes Return the year
YEARWEEK() Return the year and week