TIME_FORMAT()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a time string in the specified format.
USAGE
TIME_FORMAT(time, format)
Argument Name | Description |
---|---|
| A time expression |
| The formatting string |
DETAILS
TIME_FORMAT()
is a date-time function that returns a time string in the requested format.
The following format specifiers are supported:
Option | Description |
---|---|
| Microseconds (6 digits) |
| Hour in 2 digits (00-23) |
| Hour in 2 digits (01-12) |
| Hour in 2 digits (01-12) |
| Minute in 2 digits |
| Hour in 1 to 2 digits (0-23) |
| Hour in 1 to 2 digits (1-12) |
| AM or PM according to the current locale |
| An alias for |
| Seconds in 2 digits |
| Seconds in 2 digits |
| An alias for "%H:%i:%S" |
| A literal |
A NULL
is returned if either argument is NULL
.
EXAMPLES
SELECT TIME_FORMAT('14:00:00', '%H %I %l');
+-------------------------------------+
| TIME_FORMAT('14:00:00', '%H %I %l') |
+-------------------------------------+
| 14 02 2 |
+-------------------------------------+