Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1 KB

File metadata and controls

39 lines (28 loc) · 1 KB
description
Returns the last day of the month for the specified date or timestamp.

LAST_DAY

Syntax

LAST_DAY(date_timestamp_expression string) → date

  • date_timestamp_expression: A DATE or TIMESTAMP 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 %}

Usage Notes

The return value is always a date regardless of whether date_timestamp_expression is a date or a timestamp.