THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL TIME() Function

❮ MySQL Functions

Example

Extract the time value from a time expression:

SELECT TIME("19:30:10");
Try it Yourself »

Definition and Usage

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

Note: If expression is not a time or datetime, the TIME() function will return "00:00:00". If expression is NULL, the TIME() function will return NULL.

Syntax

TIME(expression)

Parameter Values

Parameter Description
expression Required. The time/datetime value from which the time should be extracted

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1.1

More Examples

Example

Extract the time value from a datetime expression:

SELECT TIME("2017-08-15 19:30:10");
Try it Yourself »

Example

Extract the time value from a datetime expression:

SELECT TIME("2017-08-15 19:30:10.000001");
Try it Yourself »

Example

Extract the time value from NULL:

SELECT TIME(NULL);
Try it Yourself »

❮ MySQL Functions