DMN Conversion Functions

◷ Reading Time: 4 minutes

number

Convert from to a number.

 number (from, grouping separator, decimal separator)
  • from (string): a number in the form of a string with grouping consisting of a space (‘ ‘), comma (‘ ,‘), period (‘,’), or null (Mandatory)
  • grouping separator (string): a period, comma, or null, but not be the same as the decimal separator unless both are null (Mandatory)
  • decimal separator (string): a period, comma, or null, but SHALL NOT be the same as the grouping separator unless both are null (Mandatory)
Example: number("1,000.0", ",", ".")

Result: 1000
Example: number("1.000.000,01", ".", ",")

Result: 1000000.01

years and months duration

Return years and months duration between two given dates (from and to).

 years and months duration (from, to)
  • from, to (both are date or both are date and time): dates separated by a comma (‘ ,‘) (Mandatory)
Example: years and months duration(date("2011-12-22"),date("2013-08-24"))


Result: P1Y8M
Example: years and months duration(date and time("-2016-01-30T09:05:00"), date and time("-2017-02-28T02:02:02"))


Result: P-11M

time

Converts from to time (ignoring date components)

 time (from)
  • from (string): DMN valid time format, date and time format, or hour:minute:second±(offset in days time duration)(Mandatory)
Example: time("23:59:01.987654321") + duration("PT2M")


Result: 00:01:01.987
Example: time("13:20:00+05:00")


Result: 13:20:00+05:00
Example: time(11, 59, 45, duration("PT0H"))


Result: 11:59:45Z
Example: time(date and time("2012-12-25T1:00:00Z")) == time("1:00:00Z")


Result: true

date

Converts from to date (ignoring time components)

 date (from)
  • from (string): DMN valid date format or date and time format (Mandatory)
Example: date(date and time("2012-12-25T1:00:00Z"))


Result: 2012-12-25
Example: date(date and time("2012-12-25T1:00:00Z")) == date("2012-12-25")


Result: true

duration

Convert from to a days and time or years and months duration

 duration (from)
  • from (string): DMN valid days and time or years and months (Mandatory)
Example: (date and time("2012-12-24T23:59:00") - date and time("2012-12-22T03:45:00")) == duration("P2DT20H14M")


Result: true

date and time

Converts from to a date and time. Also, creates a date time from the given date (ignoring any time component) and the given time.

 date and time (from)
  • from (date and time string): DMN valid date and time or with two arguments: date (or date and time) and time (Mandatory)
Example: date and time("2012-12-25T00:00:00")


Result: 2012-12-25T00:00:00
Example: date and time(date("2017-01-01"),time("23:59:01"))


Result: 2017-01-01T23:59:01
Example: date and time(date("2017-01-01T07:00:00"),time("23:59:01"))

Result: 2017-01-01T23:59:01
Updated on September 12, 2025

Was this article helpful?

Related Articles