- Categories:
LAST_DAY¶
Returns the last day of the specified date part for a date or timestamp. This function is commonly used to return the last day of the month for a date or timestamp.
- See also:
Syntax¶
Arguments¶
date_or_timestamp_exprA date or a timestamp, or an expression that can be evaluated to a date or a timestamp.
date_partThe date part for which the last day is returned. Possible values are
year,quarter,month, orweek(or any of their supported variations). For more information, see Supported date and time parts.When
date_partisweek(or any of its variations), the output is controlled by the WEEK_START session parameter. For more details, including examples, see Calendar weeks and weekdays.For more information, including examples, see Calendar weeks and weekdays.
Default:
month
Returns¶
This function returns a value of type DATE, even if date_or_timetamp_expr is a timestamp.
Examples¶
Return the last day of the month for the specified date (from a timestamp):
Return the last day of the year for the specified date (from a timestamp):