Contact Us 1-800-596-4880

minutes

minutes(nMinutes: Number): Period

Creates a Period value from the provided number of minutes.

The function applies the duration function to the input value.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

nMinutes

The number of minutes as a whole or decimal number. A positive or negative number is valid.

Example

This example shows how minutes behaves with different inputs. It adds and subtracts hours from DateTime values. It also converts the decimal value 4.555 into the Period format (PT4M33.3S) and and the whole number 4 into the Period format (PT4M). Notice that minutes(-1) + minutes(2) returns the number of seconds.

Source

%dw 2.0
import * from dw::core::Periods
output application/json
---
{
   nextMinute: |2020-10-05T20:22:34.385Z| + minutes(1),
   previousMinute: |2020-10-05T20:22:34.385Z| - minutes(1),
   decimalInputPeriod: minutes(4.555),
   wholeNumberInputPeriod: minutes(4),
   addNegativeValue: minutes(-1) + minutes(2)
}

Output

{
   "nextMinute": "2020-10-05T20:23:34.385Z",
   "previousMinute": "2020-10-05T20:21:34.385Z",
   "decimalInputPeriod": "PT4M33.3S",
   "wholeNumberInputPeriod": "PT4M",
   "addNegativeValue": 60
}