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


ToDateFunction_Hive

Please click on the follow button to get updates on latest posts.

6 comments

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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