TIMESTAMP returns the timestamp portion of a value.

Syntax

TIMESTAMP ( expression )

Arguments

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

Returns

  • A TIMESTAMP.

  • Returns NULL if expression is NULL.

Examples

SELECT orderDate, TIMESTAMP(orderDate) AS orderDateTimestamp FROM MYSQL.inventory.cust;

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