---
schema_version: "1"
id: 0566106b13c7161237c46b04863954f493c8c4711cc1f8a5b81ffb2fce1f43d4
title: between
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/latest/dw-periods-functions-between.md
canonical_url: https://docs.mulesoft.com/dataweave/latest/dw-periods-functions-between
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 38271646cb92c2ec07fb79753bdc36572da171fe7f39ece0d53d517891d3bf86
description: MuleSoft Documentation Site
release: "2.13"
latest: true
---
---
product: DataWeave
version: 2.13
is-latest-version: true
---

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