Versions:

days_in_month()

Given a timestamptz, returns how many days are in that month.

Required arguments

NameTypeDescription
dateTIMESTAMPTZTimestamp to use to calculate how many days in the month

Sample usage

Calculate how many days in the month of January 1, 2022:

SELECT toolkit_experimental.days_in_month('2021-01-01 00:00:00+03'::timestamptz)

The output looks like this:

days_in_month
----------------------
31

Found an issue on this page?

Report an issue!

Keywords

Related Content