Formats a TIME value into a string according to the specified format. Similar to DATE_FORMAT but designed specifically for time values.
VARCHARDiperbarui: 13 Jun 2026TIME_FORMAT(time, format)The time value to format
The format string (%H, %i, %s, etc.)
1 SELECT TIME_FORMAT('14:30:45', '%H:%i:%s') AS time_24h;
Format time in 24-hour notation.
1 SELECT TIME_FORMAT('14:30:00', '%h:%i %p') AS time_12h;
Format time in 12-hour notation with AM/PM.
1 SELECT TIME_FORMAT(duration, '%H hours %i minutes') AS formatted_duration 2 FROM tasks;
Format a duration with labeled units.
Sudah paham TIME_FORMAT? Latih langsung di browser
Latihan interaktif, langsung di browser.