Athena find last day of month

Viewed 2391

I want to pass current_date through and return the last day of the month. I have tried LAST_DAY(current_date), but I am receiving the following error:

Function last_day not registered

I checked PrestoDB docs for a similar function. But, was unable to locate one.

Has anyone encountered similar in Athena, would you mind sharing how you resolved this? Thank you.

1 Answers

AFAIK there is no built-in function for this, but you can always do some "math" yourself:

SELECT date_trunc('month', date '2012-08-08') + interval '1' month - interval '1' day
Related