days_in_month()

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

Required arguments

Name Type Description
date TIMESTAMPTZ Timestamp to use to calculate how many days in the month

Sample usage

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

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

The output looks like this:

2. days_in_month

4. ----------------------

6. 31