0
votes

I'm trying to filter data between Jan 1st, 2021 and Jan 31st, 2021 in a Hive table. The column containing the date is in timestamp format (yyyy-mm-dd hh-mm-ss). Is there a way to filter just based on year() month and date without inputting the timing? Any examples/sample code would be welcome!

1

1 Answers

0
votes

You can use to_date( dt_time timestamp) dt to convert to date and remove time part.

select current_timestamp() , to_date(current_timestamp() )

enter image description here

Select * from table 
Where
To_date(input_datetime ) between to_date(from_datetime) and to_date (to_datetime)