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

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