Outdated Version

You are viewing an older version of this section. View current production version.

TIME_FORMAT

Convert the input time object to a string according to the specified format.

TIME_FORMAT (timeobj, format)

Arguments

  • timeobj: a valid time, date, datetime, or parsable date string
  • format: a string containing format symbols. Only format symbols for the hour, minute, second, and microsecond parts are valid.

See DATE_FORMAT for a description of format symbols.

Return Type

String

Examples

select time_format('12:05:47', '%s, %i, %h');
+---------------------------------------+
| time_format('12:05:47', '%s, %i, %h') |
+---------------------------------------+
| 47, 05, 12                            |
+---------------------------------------+