Calculates the difference between two dates in months.
datemonthdifference(startDate, endDate)
| Parameter | Type | Description |
|---|---|---|
startDate |
String | Start date (ISO 8601 format) |
endDate |
String | End date (ISO 8601 format) |
String - The number of months between the two dates.
The datemonthdifference function calculates how many months have elapsed between two dates. The result is positive when endDate is after startDate, and negative otherwise.
Result = DATEMONTHDIFFERENCE("2025-01-15T00:00:00.000Z", "2025-04-15T00:00:00.000Z")
// Result: "3"
Result = DATEMONTHDIFFERENCE("2025-06-01T00:00:00.000Z", "2025-01-01T00:00:00.000Z")
// Result: "-5"
MonthsSubscribed = DATEMONTHDIFFERENCE(SubscriptionStart, Today)
- Subscriptions: Calculate subscription duration
- Billing: Monthly billing periods
- Age: Age in months
- Project tracking: Project duration
- datedaydifference - Difference in days
- dateweekdifference - Difference in weeks
- dateyeardifference - Difference in years
- dateaddmonths - Add months to a date
- Uses ISO 8601 date format
- Result can be negative
- Uses the Dates service internally