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

# days

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

## days(nDays: Number): Period

Creates a Period value from the provided number of days.

The function applies the `period` function to input that is a whole number and the `duration`
function to decimal input.

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>nDays</code></p></td><td><p>The number of hours as a whole or decimal number. A positive or negative number is valid.</p></td></tr></tbody></table>

### Example

This example shows how `days` behaves with different inputs. It adds and subtracts hours from
DateTime values. It also converts the decimal value `4.555` into a number of hours, minutes, and
second in the Period format (`PT109H19M12S`) and the whole number `4` into a number of days in the
Period format (`P4D`).

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Periods
output application/json
---
{
   tomorrow: |2020-10-05T20:22:34.385Z| + days(1),
   yesterday: |2020-10-05T20:22:34.385Z| - days(1),
   decimalDaysPlusQuarter:  |2020-10-05T00:00:00.000Z| + days(0.25),
   decimalDaysPlusHalf:  |2020-10-05T00:00:00.000Z| + days(0.5),
   decimalDaysPlusThreeQuarters:  |2020-10-05T00:00:00.000Z| + days(0.75),
   decimalInputAsPeriod : days(4.555),
   fourDayPeriod: days(4),
   negativeValue: days(-1)
}
```

#### Output

```Json
{
   "tomorrow": "2020-10-06T20:22:34.385Z",
   "yesterday": "2020-10-04T20:22:34.385Z",
   "decimalDaysPlusQuarter": "2020-10-05T06:00:00Z",
   "decimalDaysPlusHalf": "2020-10-05T12:00:00Z",
   "decimalDaysPlusThreeQuarters": "2020-10-05T18:00:00Z",
   "decimalInputAsPeriod": "PT109H19M12S",
   "fourDayPeriod": "P4D",
   "negativeValue": "P-1D"
}
```
