%dw 2.0
output application/json
import * from dw::core::Periods
---
{
   dayBeforeDateTime: |2020-10-05T20:22:34.385Z| - period({days:1}),
   dayAfterDate: |2020-10-05| + period({days:1}),
   yearMonthDayAfterDate: |2020-10-05| + period({years:1, months:1, days:1}),
   emptyPeriod: period({}),
   constructPeriod: period({years:4, months:11, days:28}),
   selectMonthsFromPeriod: period({years:4, months:11, days:28}).months
}
period
period(period: { years?: Number, months?: Number, days?: Number }): Period
Creates a Period value as a date-based number of years, months, and days in the ISO-8601 calendar system.
Introduced in DataWeave version 2.4.0.
Parameters
| Name | Description | 
|---|---|
  | 
An object such as   | 
Example
This example shows how period behaves with different inputs. The example
add a subtracts and adds the result of a period function to DateTime and
Date values. It also constructs a Period value from period objects
and selects a months value from the object.



