tomonths(X;Y)

Convert a string, days, or months value to an integer value representing the number of months. (Available as of version 15.19)

Syntax

tomonths(X;Y)

Input

Argument Type Description
X text A scalar value or the name of a column containing a time interval
Valid values can be of the form:
  • string
  • months
  • days
Y text

Return Value

Returns an integer value representing the number of months. 30 days=1 month. This result can then be used in functions such as shiftmonths(X;Y;E)

For more information about date formats, see Dates and time.

If the input values are not in one of the supported formats listed above, the function returns an erroneous or illogical output.

Example

The following example converts a period of time into an integer representing the months interval. Fractional months are dropped.

<table cols="time_interval">
"1.5 weeks"
"59 days"
"2.3 years"
"10.2 weeks"
"3.5 months" 
</table>

<willbe name="months_interval" value="tomonths(time_interval;)"/>