---
schema_version: "1"
id: ea5cc3131da34d3b5c2a949755a4c7bddab46c874bbe181d0629435b67fc0be5
title: between
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-periods-functions-between.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-periods-functions-between
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 33a74f151ebdcab1937b245f717814a86a68a91a3f61b07844d5651146f882c0
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# between

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## between(endDateExclusive: Date, startDateInclusive: Date): Period

Returns a Period (P) value consisting of the number of years, months, and days between two Date
values.

The start date is included, but the end date is not. The result of this method can be a negative
period if the end date (`endDateExclusive`) is before the start date (`startDateInclusive`).

Note that the first parameter of the function is the `endDateExclusive` and the second one is the
`startDateInclusive`.

_Introduced in DataWeave version 2.3.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>endDateExclusive</code></p></td><td><p>The end date, exclusive.</p></td></tr><tr><td><p><code>startDateInclusive</code></p></td><td><p>The start date, inclusive.</p></td></tr></tbody></table>

### Example

This example shows how `between` behaves with different inputs.

#### Source

```DataWeave
import * from dw::core::Periods
output application/json
---
{
   a: between(|2010-12-12|,|2010-12-10|),
   b: between(|2011-12-11|,|2010-11-10|),
   c: between(|2020-02-29|,|2020-03-30|)
}
```

#### Output

```Json
{
   "a": "P2D",
   "b": "P1Y1M1D",
   "c": "P-1M-1D"
 }
```
