%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
toPeriodEx1: toPeriod("P1D"),
toPeriodEx2: toPeriod("PT1H1M")
}
DataWeave
toPeriod
toPeriod(str: String): Period
Transform a String
value into a Period
value.
Introduced in DataWeave version 2.4.0.
Parameters
Name | Description |
---|---|
|
The |
Example
This example shows how toPeriod
behaves with different inputs.
It produces output in the application/dw
format.
Source
Output
{ toPeriodEx1: |P1D|, toPeriodEx2: |PT1H1M| }
Json