Apache Hive : HPL/SQL - TO_TIMESTAMP Function

Last updated: August 12, 2026

Apache Hive : HPL/SQL - TO_TIMESTAMP Function

TO_TIMESTAMP function converts a string to TIMESTAMP data type using the specified format.

Syntax:

TO_TIMESTAMP(string_expression, format_expression); 

Return Data Type:

TIMESTAMP

Format Elements:

ElementDescription
YYYY4-digit year
MMMonth (1-12)
DDDay (1-31)
HH24Hour of the day (0-23)
MIMinute (0-59)
SSSecond (0-59)

Examples:

TO_TIMESTAMP('2015-04-02', 'YYYY-MM-DD');
TO_TIMESTAMP('04/02/2015', 'mm/dd/yyyy');
TO_TIMESTAMP('2015-04-02 13:51:31', 'YYYY-MM-DD HH24:MI:SS');

Compatibility: Oracle, IBM DB2, Teradata

See also: