DAY_MICROSECOND is a MySQL-specific temporal unit used with functions such as DATE_ADD, DATE_SUB, TIMESTAMPDIFF, EXTRACT, and CAST ... AS INTERVAL. It represents a span of time that includes:- Days (0-34, or larger when SQL mode ALLOW_INVALID_DATES is off)- Hours (0-23)- Minutes (0-59)- Seconds (0-59)- Microseconds (0-999999)The literal value must be written as a string in the format 'DD HH:MM:SS[.microseconds]'. When supplied to date-arithmetic functions, MySQL converts the value to an internal integer number of microseconds and adds or subtracts it from the given DATETIME or TIMESTAMP. When used with EXTRACT, it returns an integer constructed as DHHMMSSUUUUUU (for example, 2 hours → 002000000000). Microseconds are available only in MySQL 5.6.4 and later. If the literal is malformed, MySQL returns NULL and emits a warning.
datetime_expr
(DATETIME / TIMESTAMP) - The date or timestamp to operate oninterval_str
(VARCHAR) - A string formatted as 'DD HH|||MM|||SS[.microseconds]' representing the spanunit
(KEYWORD) - The literal keyword DAY_MICROSECOND identifying the composite unitINTERVAL, DATE_ADD, DATE_SUB, EXTRACT, CAST, DAY_SECOND, HOUR_MICROSECOND
MySQL 5.6.4 (microsecond support added)
Use a quoted string like 'DD HH:MM:SS[.microseconds]'. Example: '1 02:03:04.123456'.
No. It is only implemented in MySQL and MariaDB. Other databases have different interval syntaxes.
Yes. Prefix the literal with a minus sign ('-1 00:00:00') or subtract it with DATE_SUB.
Up to six fractional digits (microseconds) when running on MySQL 5.6.4 or later.