TheDataGuy
TheDataGuy

Reputation: 3118

Hive - Group by datetime column to date only

In my table eventtime column looks like,

2017-03-25T03:18:00001Z
2017-03-25T05:21:00013Z

I want to group by eventtime with date only.

Like

2017-03-18, 2017-03-21

Upvotes: 0

Views: 1975

Answers (2)

GROUP BY CAST(myDateTime AS DATE)

Upvotes: 0

David דודו Markovitz
David דודו Markovitz

Reputation: 44991

Use it both in the GROUP BY and the SELECT clauses.

cast (from_iso8601_timestamp(eventtime) as date) 

Upvotes: 1

Related Questions