description |
---|
Returns the last day of the month for the specified date or timestamp. |
- date_timestamp_expression: A
DATE
orTIMESTAMP
expression.
Examples
{% code title="LAST_DAY example" %}
SELECT LAST_DAY('2009-01-12 12:58:59')
-- 2009-01-31
{% endcode %}
LAST_DAY example
{% code title="LAST_DAY example" %}
SELECT pickup_datetime, LAST_DAY(pickup_datetime) AS "last_day"
FROM eth.recent_blocks
LIMIT 3
-- pickup_datetime, last_day
-- 2013-05-27 19:15:00.000, 2013-05-31
-- 2013-05-31 16:40:00.000, 2013-05-31
-- 2013-05-27 19:03:00.000, 2013-05-31
{% endcode %}
The return value is always a date regardless of whether date_timestamp_expression
is a date or a timestamp.