ID EN
Date and Time Functions

TIME(expr)

MySQL 8.4

Extracts the time part of the time or datetime expression expr and returns it as a string. Returns NULL if expr is NULL.

Syntax

MYSQL
SELECT TIME('2003-12-31 01:02:03');
'01:02:03'
SELECT TIME('2003-12-31 01:02:03.000123');
'01:02:03.000123'

Examples

Example

This function is unsafe for statement-based replication. A warning is logged if you use this function when binlog_format is set to STATEMENT.

MYSQL
SELECT TIME('2003-12-31 01:02:03');
'01:02:03'
SELECT TIME('2003-12-31 01:02:03.000123');
'01:02:03.000123'