Going Stellar

Home/CQL reference

CQL function

endOfYear() in CQL: syntax and examples for Confluence

endOfYear() closes the current year. With "-1y" or "-2y" it names the end of an earlier year, so you can ask for content last touched before a given year was over. That makes it the natural cut for an annual archive review.

Syntax

endOfYear()
endOfYear("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 ~ endOfYear() is rejected)

Examples

created < endOfYear()

Content created by the end of this year. This is the documentation example.

Run on Confluence Cloud on .

lastmodified < endOfYear("-1y") AND type = page ORDER BY lastmodified ASC

Pages not edited since last year ended, oldest first, as the working list for a yearly cleanup.

Run on Confluence Cloud on .

lastmodified <= endOfYear("-2y")

Anything untouched since the end of the year before last. A stricter cut when the first list is too long.

Run on Confluence Cloud on .

created > endOfYear("-1y") AND created <= endOfYear() AND space = SD

Everything created in one space during the current year, for a year-end count.

Run on Confluence Cloud on .

lastmodified < endOfYear("-1y") AND type = attachment

Attachments last modified before last year ended, as a starting point for a file storage review.

Run on Confluence Cloud on .

Pitfalls

  • The year ends at the start of the next one. On the Confluence Cloud site checked in November 2026, endOfYear() resolved to 00:00 on 1 January 2027, and endOfYear("-1y") to 00:00 on 1 January 2026.
  • The offset is relative to today, so endOfYear("-1y") means the end of last year only until the calendar turns. Re-read it when you copy a saved query into next year's checklist.
  • The year unit is lower case. endOfYear("-1Y") is not a valid unit and fails with HTTP 500 "IllegalArgumentException executing cql".
  • A page on this list is stale by edit date only. People may still read it every week, so check views or ownership before archiving.

Sources

  1. CQL functions (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages