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

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.

last_day_in_hive

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

Facebook photo

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

Connecting to %s