LAST_DAY

Syntax

LAST_DAY
(
  value  IN date
)
RETURNS date;

LAST_DAY
(
  value  IN TIMESTAMP with time zone
)
RETURNS TIMESTAMP without time zone;

Overview

The LAST_DAY function returns the last day of the month to which the given date belongs.

For the DATE type, it simply calculates the last day of the month.

For the TIMESTAMPTZ type, the date is truncated and the original time information is combined to return a timestamp value.

Parameters

Parameter
Description

value

date, timestamptz type: the base date to get the last date from. For timestamptz, it is calculated by finding the first day of the month, adding one month and subtracting one day.

Example

Last updated