User Tools

Site Tools


Sidebar

HPL/SQL is included to Apache Hive since version 2.0

to-timestamp

TO_TIMESTAMP Function - PL/HQL Reference

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:

YYYY 4-digit year
MM Month (1-12)
DD Day (1-31)
HH24 Hour of the day (0-23)
MI Minute (0-59)
SS Second (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

Version: PL/HQL 0.3.1

See also: