---
schema_version: "1"
id: c0360542eb15763ebae7a911c3e9221865641500fc019d723a4fee1728b28856
title: daysBetween
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-core-functions-daysbetween.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-core-functions-daysbetween
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 6b8ae5c37b15dd81ee0c4406d916dd9b5f621d5d0a50fcd89a1e947ddc6fe4a1
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# daysBetween

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

## daysBetween(from: Date, to: Date): Number

Returns the number of days between two dates.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>from</code></p></td><td><p>From date (a <code>Date</code> type).</p></td></tr><tr><td><p><code>to</code></p></td><td><p>To date (a <code>Date</code> type). Note that if the <code>to</code> date is <em>earlier</em> than the <code>from</code> date, the function returns a negative number equal to the number of days between the two dates.</p></td></tr></tbody></table>

### Example

This example returns the number of days between the specified dates.

#### Source

```DataWeave
%dw 2.0
output application/json
---
{ days : daysBetween('2016-10-01T23:57:59-03:00', '2017-10-01T23:57:59-03:00') }
```

#### Output

```JSON
{ "days" : 365 }
```
