Cast duration of time

types.castDuration(format = "default", value)

Arguments

format

no options (other than the default)

value

duration to cast

Details

We follow the definition of XML Schema duration datatype directly and that definition is implicitly inlined here.

To summarize: the lexical representation for duration is the ISO 8601 extended format PnYnMnDTnHnMnS, where nY represents the number of years, nM the number of months, nD the number of days, 'T' is the date/time separator, nH the number of hours, nM the number of minutes and nS the number of seconds. The number of seconds can include decimal digits to arbitrary precision. Date and time elements including their designator may be omitted if their value is zero, and lower order elements may also be omitted for reduced precision.

See also

Examples

types.castDuration(format = "default", value = durations(years= 10))
#> [1] "10 Years, 0 Months, 0 Days, 0:00:00"
types.castDuration(format = "default", value = "P1Y10M3DT5H11M7S")
#> [1] "1 Years, 10 Months, 3 Days, 5:11:07"