ID EN
Date and Time Functions

TIME_FORMAT(time,format)

MySQL 8.4

This is used like the DATE_FORMAT() function, but the format string may contain format specifiers only for hours, minutes, seconds, and microseconds. Other specifiers produce a NULL or 0. TIME_FORMAT() returns NULL if time or format is NULL.

Syntax

MYSQL
SELECT TIME_FORMAT('100:00:00', '%H %k %h %I %l');
'100 100 04 04 4'

Examples

Example

If the time value contains an hour part that is greater than 23, the %H and %k hour format specifiers produce a value larger than the usual range of 0..23. The other hour format specifiers produce the hour value modulo 12.

MYSQL
SELECT TIME_FORMAT('100:00:00', '%H %k %h %I %l');
'100 100 04 04 4'