Converting string into date – Apache Hive

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)
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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s