%dw 2.0
import * from dw::core::Periods
output application/json
---
{
nextSecond: |2020-10-05T20:22:34.385Z| + seconds(1),
previousSecond: |2020-10-05T20:22:34.385Z| - seconds(1),
decimalInputPeriod: seconds(4.555),
wholeNumberInputPeriod: seconds(4),
addNegativeValue: seconds(-1) + seconds(2)
}
seconds
seconds(nSecs: Number): Period
Creates a Period value from the provided number of seconds.
Introduced in DataWeave version 2.4.0.
Parameters
Name | Description |
---|---|
|
The number of seconds as a whole or decimal number. A positive or negative number is valid. |
Example
This example shows how seconds
behaves with different inputs.
It adds and subtracts seconds from DateTime values. It also converts
the decimal value 4.555
into the Period format (PT4.555S
) and
and the whole number 4
into the Period format (PT4S
)