Going Stellar

Home/CQL reference

CQL function

endOfMonth() in CQL: syntax and examples for Confluence

endOfMonth() closes the current month. Used on its own it is an upper bound for this month. With "-1M" and "-2M" it gives the ends of earlier months, which is how you cut a closed month for a monthly report.

Syntax

endOfMonth()
endOfMonth("inc")

Arguments

ArgumentWhat it doesOptional
incOptional offset in the form (+/-)nn(y|M|w|d|h|m): y year, M month, w week, d day, h hour, m minute. Quoted. With no sign, plus is assumed. The unit is required and case sensitive, and the offset moves the boundary.no

Works with

  • Fields: created, lastmodified
  • Operators: =, !=, >, >=, <, <=
  • Not with: ~, !~, IN, NOT IN (checked on Confluence Cloud, November 2026: created ~ endOfMonth() is rejected)

Examples

lastmodified < endOfMonth()

Content modified before the end of this month. This is the documentation example.

Run on Confluence Cloud on .

lastmodified > endOfMonth("-1M") AND lastmodified <= endOfMonth() AND type = page

Pages edited in the current month and nothing else, for a month-end activity report.

Run on Confluence Cloud on .

created > endOfMonth("-2M") AND created <= endOfMonth("-1M")

Content created in the previous calendar month, cut with two month ends.

Run on Confluence Cloud on .

lastmodified <= endOfMonth("-3M") AND type = page ORDER BY lastmodified ASC

Pages not edited since three month ends ago, oldest first, as a review queue for stale documentation.

Run on Confluence Cloud on .

created > endOfMonth("-1M") AND ancestor = 32964613

Pages added under the handbook this month, so a policy owner sees what was introduced since the last close.

Run on Confluence Cloud on .

Pitfalls

  • The boundary is the first moment of the next month. On the Confluence Cloud site checked in November 2026, endOfMonth() in November resolved to 00:00 on 1 December, and endOfMonth("+1M") to 00:00 on 1 January.
  • Count in months, not days. endOfMonth("-1M") resolved to 00:00 on 1 November when run in November, the end of October, whatever the length of the month.
  • Offsets are case sensitive. endOfMonth("-1m") subtracts one minute, not one month, and resolved to 23:59 on 30 November. The query still runs, so the mistake is silent.
  • A bare number such as endOfMonth("1") is refused with "Invalid relative date : 1" (HTTP 400).

Sources

  1. CQL functions (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages