FEEL

duration

FEEL built-in function · FEEL date and time functions

duration(from)

Creates a days-and-time or years-and-months duration from an ISO 8601 string.

FEEL has two duration types that do not mix. Days-and-time durations (P3D, PT2H) are exact amounts of time. Years-and-months durations (P1Y, P6M) are calendar amounts whose length depends on the month. Comparing one with the other gives null, because a month is not a fixed number of days.

Durations are normalized: PT90M becomes PT1H30M and P14M becomes P1Y2M. Weeks (P2W) are not part of the notation. The components are available as .days, .hours, .minutes, .seconds, .years and .months.

Parameters

ParameterTypeDescription
fromstringISO 8601 duration, e.g. P3D, PT2H30M or P1Y6M

Examples

duration("P3DT4H")
P3DT4H Try it ↑
duration("P1Y6M")
date("2026-07-01") + duration("P3D")
2026-07-04 Try it ↑

Edge cases and null handling

duration("PT90M")
PT1H30M Try it ↑

Normalized.

duration("P14M")

Months carry over into years.

duration("-P3D")

The sign goes in front of the P.

duration("P2W")

Weeks are not accepted; write P14D. B-FEEL returns PT0S.

duration("P1D") = duration("PT24H")
duration("P1Y") = duration("P12M")
duration("P1M") = duration("P30D")

The two duration types cannot be compared.

duration("PT1H") / duration("PT15M")

Dividing durations gives a number.

duration("PT2H") * 3
duration("3 days")

Only the XML Schema duration notation is accepted.

date("2026-07-24") + duration("P" + string(5) + "D")
2026-07-29 Try it ↑

Build a duration from a number by concatenating the ISO string.

Related functions

years and months duration · date and time

Defined by the OMG DMN 1.6 specification, chapter 10.3.4 (built-in functions).