Mysql Time Function

MySQL: TIME Function

This tutorial explains how to use the MySQL TIME function with syntax and examples.


The MySQL TIME function extracts the time value from a time/datetime expression.


The syntax for the TIME function in MySQL is:

TIME( expression )

Parameters or Arguments


The time or datetime value from which the time should be extracted.


  • If expression is not a time or a datetime value, the TIME function will return '00:00:00'.
  • If expression is NULL, the TIME function will return NULL.
  • See also the CAST function.

Applies To

The TIME function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1.1


Let's look at some MySQL TIME function examples and explore how to use the TIME function in MySQL.

For example:

mysql> SELECT TIME('2014-02-14 06:18:01.000001');
Output: '06:18:01.000001'

mysql> SELECT TIME('2014-02-17 18:20:19');
Output: '18:20:19'

mysql> SELECT TIME('10:35:05');
Output: '10:35:05'

mysql> SELECT TIME('The time is 10:35:05');
Output: '00:00:00'

Output: NULL