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:

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

The output looks like this:

  1. days_in_month
  2. ----------------------
  3. 31