# getDaysInMonth

URL: https://caijiao.org/date-fns/month/getDaysInMonth
Source: docs/date-fns/month/getDaysInMonth.md
Description: 返回给定日期所在月份的天数。

返回给定日期所在月份的天数。

```javascript
import { getDaysInMonth } from "date-fns";

// 示例日期
const date = new Date(2024, 1, 1); // 2024年2月1日

// 获取给定日期所在月份的天数
const daysInMonth = getDaysInMonth(date);

console.log("给定日期所在月份的天数：", daysInMonth);
// 给定日期所在月份的天数：29
```
