Skip to content
🚀 Agentic Postgres: The first database built for agents 🤖
TimescaleDB - Timeseries database for PostgreSQL Docs
  • tigerdata.com
  • Try for free
Get started
Try the key Tiger Data features
Start coding with Tiger Data
Create a Tiger Cloud service
About Tiger Data products
Tiger Data architecture for real-time analytics
Pricing plans and account management
Feature comparison
Use Tiger Data products
Hypertables
Hypercore
Continuous aggregates
Tutorials
Integrations
API Reference
Hypertables and chunks
Hypercore
Continuous aggregates
Data retention
Jobs and automation
UUIDv7 functions
Hyperfunctions
approximate_row_count
first
last
histogram
time_bucket
time_bucket_ng
days_in_month
month_normalize
Approximate count distinct
Saturating math
Statistical and regression analysis
Minimum and maximum
Financial analysis
Gapfilling
Percentile approximation
Counters and gauges
Time-weighted calculations
Downsampling
Frequency analysis
State tracking
Informational views
Service configuration
Administration Functions
API Reference Tag Overview
Tiger Cloud REST API
Glossary
Compression (Old API, replaced by Hypercore)
Distributed hypertables (Sunsetted v2.14.x)
Import and sync
Integrate AI with Tiger Data
Other deployment options
Find a docs page
TimescaleDB API referenceHyperfunctions

days_in_month()

ToolkitTimescaleDB Toolkit functions are available under Timescale Community Edition. They are automatically included with Timescale, but must be installed separately for self-hosted TimescaleDB. Click to learn more.

Tiger Cloud: Performance, Scale, Enterprise, Free

Self-hosted products

MST

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

Required arguments

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

Keywords

hyperfunctionsToolkitnormalization

Found an issue on this page?Report an issue or Edit this page in GitHub.

Previoustime_bucket_ngNextmonth_normalize

Related Content

month_normalize()
Normalize a monthly metric based on number of days in month
Hyperfunctions
The full list of hyperfunctions available in TimescaleDB and TimescaleDB Toolkit, with required arguments, returns, and complete use examples
Downsampling functions
API reference for the downsampling functions
Saturating math functions
API reference for the saturating math functions
state_agg()
API reference for the state_agg() functions
max_n()
API reference for the max_n() functions