MySQL TIME() Function

Example

Extract the time part from a time expression:

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

Definition and Usage

The TIME() function extracts the time part from a given time/datetime.

Note: This function returns "00:00:00" if expression is not a datetime/time, or NULL if expression is NULL.

Syntax

TIME(expression)

Parameter Values

Parameter Description
expression Required. The time/datetime to extract the time from

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Extract the time part from the datetime expression:

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

Example

Extract the time part from the datetime expression:

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

Example

Extract the time part from NULL:

SELECT TIME(NULL);
Try it Yourself »

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.