LAST_DAY function
Returns the last day of the month for a given date or timestamp.
Syntax
LAST_DAY(date_expression)
Arguments
date_expression: ADATE,TIMESTAMP, orTIMESTAMP WITH TIME ZONEvalue.
Returns
A DATE representing the last day of the month for the input date.
Examples
-- Example 1: Last day of January > SELECT LAST_DAY(DATE '2025-01-15'); 2025-01-31 -- Example 2: Last day of February (non-leap year) > SELECT LAST_DAY(DATE '2025-02-10'); 2025-02-28 -- Example 3: Last day of February (leap year) > SELECT LAST_DAY(DATE '2024-02-10'); 2024-02-29 -- Example 4: Last day of a month from timestamp > SELECT LAST_DAY(TIMESTAMP '2025-06-15 10:30:00'); 2025-06-30
See Also
DATE_TRUNC function - Truncate to start of month
EXTRACT function - Extract date components