TIME returns the time portion of a value.

Syntax

TIME ( expression )

Arguments

expression: a DATE, TIMESTAMP, or non-LONG VARCHAR string value that is properly formatted to represent a DATE or TIMESTAMP.

Returns

  • A TIME value.

  • Returns NULL if expression is NULL.

Examples

SELECT orderDate, TIME(orderDate) AS orderDateTime FROM MYSQL.inventory.cust;

VALUES TIME(CAST('2012-06-20 15:23:45' AS TIMESTAMP))
-- Returns 15:23:45