TO_DATE function in Apache Hive helps in converting the string into DATE format. If the string has date and time, it will convert and return the date part.
Syntax: to_date(string timestamp)
Examples:
SELECT TO_DATE(SUBSTR(‘ON 2020-04-01’, 4, 10));
This returns 2020-04-01
SELECT TO_DATE(‘2020-04-01 13:04:05.000’);
This returns 2020-04-01
Please click on the follow button to get updates on latest posts.
6 comments