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

# 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"
 }
```
