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

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