LAST_DAY
functionsupportedCore SQL functionsReturns 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.
Syntax
supportedpartialnot supportednot scored
LAST_DAY( <date_or_timestamp_expr> [ , <date_part> ] )
Parameters
| Name | Required | Description |
|---|---|---|
date_or_timestamp_expr | required | A date or a timestamp, or an expression that can be evaluated to a date or a timestamp. |
date_part | required | The date part for which the last day is returned. Possible values are year, quarter, month, or week (or any of their supported variations). For more information, see Supported date and time parts. When date_part is week (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_timestamp_expr is a timestamp.