Example
Format a given time value.
SELECT TIME_FORMAT(“19:30:10”, “%H %i %s”); |
The TIME_FORMAT() function formats a time according to a specified format.
TIME_FORMAT(time, format) |
Parameter |
Description |
||||||||||||||||||||||
time |
Required: The time that you want to format |
||||||||||||||||||||||
format |
Required: The format to apply, which can be one or a combination of the following:
|
Works in: |
From MySQL version 4.0 |
Format a given time according to a specified format.
SELECT TIME_FORMAT(“19:30:10”, “%h %i %s %p”); |
Display a time in a specified format.
SELECT TIME_FORMAT(“19:30:10”, “%r”); |
Specify the presentation of a time.
SELECT TIME_FORMAT(“19:30:10”, “%T”); |