TIME_FORMAT()

Overview

Returns a time string in the specified format.

USAGE

TIME_FORMAT(time, format)

Argument Name

Description

time

A time expression

format

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

%f

Microseconds (6 digits)

%H

Hour in 2 digits (00-23)

%h

Hour in 2 digits (01-12)

%I

Hour in 2 digits (01-12)

%i

Minute in 2 digits

%k

Hour in 1 to 2 digits (0-23)

%l

Hour in 1 to 2 digits (1-12)

%p

AM or PM according to the current locale

%r

An alias for %I:%i:%S %p

%S

Seconds in 2 digits

%s

Seconds in 2 digits

%T

An alias for "%H:%i:%S"

%%

A literal % character

A NULL is returned if either argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT TIME_FORMAT('14:00:00', '%H %I %l');
+-------------------------------------+
| TIME_FORMAT('14:00:00', '%H %I %l') |
+-------------------------------------+
| 14 02 2                             |
+-------------------------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES