Name

months( ) — normalizes a yearMonthDuration into a number of months

Synopsis

Defined in: XForms 1.0
Parameters: string dayTimeDuration (required)
Return type: number

This function computes a whole number of months that is equivalent in length to the yearMonthDuration parameter (formatted according to XML Schema rules).

Tip

This function makes the distinction of working on a yearMonthDuration, which is a more fine-grained datatype than defined by XML Schema. Chapter 4 discusses this in greater detail.

This example returns 14:

months("P1Y2M")

Get XForms Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.