Example
Format a time:
SELECT TIME_FORMAT("19:30:10", "%H %i %s");
Definition and Usage
The TIME_FORMAT() function formats a time by a specified format.
Syntax
TIME_FORMAT(time, format)
Parameter Values
Parameter | Description | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
time | Required. The time to be formatted | ||||||||||||||||||||||
format | Required. The format to use. Can be one or a combination of the following:
|
Technical Details
Works in: | From MySQL 4.0 |
---|
More Examples
Example
Format a time:
SELECT TIME_FORMAT("19:30:10", "%h %i %s %p");
Example
Format a time:
SELECT TIME_FORMAT("19:30:10", "%r");
Example
Format a time:
SELECT TIME_FORMAT("19:30:10", "%T");