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

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