addMonths()

The addMonths() function provides the ability to add or subtract months from a date.

Syntax

addMonths(date, integer)

Argument Description
date

(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).
integer

(required)

The value to add to the date argument.  If the value provided is not an integer, it will be rounded to the nearest integer.

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

addMonths("2023-04-20", 3)

addMonths("2023-04-20", 3.2)

both of the examples above would result in 2020-10-20 (i.e., 20 July 2023)

addMonths(dueDate__c, -2)

Field Editability expression

Tab Visibility expression

Business rules: Condition

Stage_3_date__c < addMonths(Stage_2_date__c, 1)
Business rules: Notification Subject

Business rules: Notification Body

Dynamic Filter

{!addMonths(Stage_2_date__c, estimated_effort__c)}

{!addMonths(due_date__c, -3)}

Embedded Section URL attribute

Business Rule: URL Call

External View URL on List/View

{!URL1__c & "/" & addMonths(Program_Start_Date__c, -1)}
Metric expression sumif(Initiative__t, OPEX__m, active and due_date__c < addMonths(Start_Date__c, 1))

sumif(Initiative__t, betweenDates(Revenue_Impact__m, Impact_Start_date__c, addMonths(Impact_Start_date__c, 3)), Business_Unit__c="Alpha" and Phase__c=1)

 

Updated on September 26, 2024

Related Articles