SECOND returns the seconds portion of a value.

Syntax


SECOND ( expression )

Arguments

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

Returns

  • An INTEGER between 0 and 59. Returns NULL if expression is NULL.

Examples


SELECT orderDate, SECOND(orderDate) AS orderDateSecond FROM MYSQL.inventory.cust;

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