Get last day of the month in Apache Hive

LAST_DAY function returns the last day of the month which the date belongs to. Date is a string in the format ‘yyyy-MM-dd HH:mm:ss’ or ‘yyyy-MM-dd’. The time part of date is ignored.

Syntax: last_day(string date)

SELECT last_day(current_date);
Returns 2021-02-28 since it was executed on 6th Feb 2021

SELECT last_day(current_timestamp);
Returns the same and the time-part has been ignored.



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 )

Facebook photo

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

Connecting to %s