---
title: diffQuarters()
slug: diffquarters
createdAt: 2026-02-09T14:47:05.730Z
---

Returns the number of whole calendar quarters between two dates. The result is positive when `date2` is after `date1`, and negative when `date2` is before `date1`.

### Syntax

`diffQuarters(date1, date2)`

### Parameters

| **Parameter** | **Type**                                   | **Description**                     |
| ------------- | ------------------------------------------ | ----------------------------------- |
| `date1`       | **[Date](https://docs.charthop.com/date)** | The date from which counting begins |
| `date2`       | **[Date](https://docs.charthop.com/date)** | The date at which counting ends     |

### Return Type

**[Number](https://docs.charthop.com/ucI5-number)**

The number of whole quarters between the two dates. Partial quarters are not counted.

### Examples

`diffQuarters('2025-01-01', '2025-12-31')`

- Returns `3` because there are 3 full quarters between January 1 and December 31.

`diffQuarters('2025-01-01', '2026-01-01')`

- Returns `4` because there are exactly 4 quarters in a full year.

### Related Carrot

- **[diffDays()](https://docs.charthop.com/diffdays)** - Returns the number of days between two dates
- **[diffWeeks()](https://docs.charthop.com/diffweeks)** - Returns the number of whole weeks between two dates
- **[diffMonths()](https://docs.charthop.com/diffmonths)** - Returns the number of whole months between two dates
- **[diffYears()](https://docs.charthop.com/diffyears)** - Returns the number of whole years between two dates
