The months() function returns the number of months/periods between two dates.
Syntax
months(date1, date2)
| Argument | Description |
| date1
(required) |
An expression that results in a date value (i.e., a hard-coded date, a reference to a date attribute, or a function that returns a date value). |
| date2
(required) |
An expression that results in a date value (i.e., a hard-coded date, a reference to a date attribute, or a function that returns a date value).
This date will be subtracted from the first date argument to produce the result of the function. Note: if either argument in this function resolves to <empty>, the returned value will be <empty>. |
Where Available
Available in all places the expression or injected expression icon is visible, as well as within Filter fields on Cards, Tables and List/View sections.
Examples
| Where | Example(s) |
| Business rules: Set Value
Attribute expression |
months("2025-10-01", "2025-12-01")
result: 2
result: -1
|
| Field Editability expression
Tab Visibility expression Business rules: Condition |
LOE_Estimate__c < months(Stage_2_Start__c, Stage_1_Start__c) |
| Business rules: Notification Subject
Business rules: Notification Body Dynamic Filter |
{!months(Stage_2_Start__c, Stage_1_Start__c)}
|
| Embedded Section URL attribute
External View URL on List/View |
{!URL1__c & “/” & months(due_date__c, today())} |
| Metric expression | sumif(Initiative__t, OPEX__m, active and LOE_Estimate__c < months(Stage_2_Start__c, Stage_1_Start__c)) |