In MySQL and MariaDB, HOUR_MICROSECOND is one of the multi-part interval units accepted by functions such as DATE_ADD(), DATE_SUB(), TIMESTAMPADD(), TIMESTAMPDIFF(), and EXTRACT(). It encodes four time components—hours, minutes, seconds, and microseconds—into a single literal, enabling high-precision calculations down to one-millionth of a second. The literal must follow the format 'HHHHHH:MM:SS.microseconds', where:• HHHHHH is one to six digits of hours (leading zeros optional)• MM is two-digit minutes (00-59)• SS is two-digit seconds (00-59)• microseconds is six digits (000000-999999)When used with DATE_ADD() or DATE_SUB(), the literal adjusts a DATETIME or TIMESTAMP value by the specified interval. With EXTRACT(), MySQL returns the composite value as an integer (HHMMSSuuuuuu) for analytical queries. Because the unit bundles multiple fields, it eliminates the need to add each component separately and preserves microsecond precision in a single operation.Caveats:• The microseconds portion is truncated if the source column lacks fractional seconds.• Invalid minute/second ranges (≥60) raise ER_BAD_TIME_ERROR.• HOUR_MICROSECOND is not part of the ANSI SQL standard and is unsupported in PostgreSQL, SQL Server, Oracle, or SQLite.
DATE_ADD, DATE_SUB, TIMESTAMPADD, TIMESTAMPDIFF, EXTRACT, HOUR_SECOND, SECOND_MICROSECOND, MICROSECOND
MySQL 5.6
Use 'HHHHHH:MM:SS.microseconds'. The microseconds part must be six digits.
No. It is specific to MySQL and MariaDB.
MySQL stores the date-time but silently truncates the microseconds portion.
Use EXTRACT(HOUR_MICROSECOND FROM time_expr) to return an integer like 120530999888.