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

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