---
title: days_in_month() | Tiger Data Docs
description: Calculates days in month given a timestamptz
---

Since [1.16.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/1.16.0)

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

## Samples

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

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

The output looks like this:

```
days_in_month
---------------------
31
```

## Arguments

The syntax is:

```
SELECT days_in_month('<date>');
```

| Name   | Type        | Default | Required | Description                                              |
| ------ | ----------- | ------- | -------- | -------------------------------------------------------- |
| `date` | TIMESTAMPTZ | -       | ✔        | Timestamp to use to calculate how many days in the month |

## Returns

| Column          | Type    | Description                                             |
| --------------- | ------- | ------------------------------------------------------- |
| `days_in_month` | INTEGER | The number of days in the month of the input timestamp. |
