Going Stellar

Home/CQL reference

CQL function

startOfYear() in CQL: syntax and examples for Confluence

startOfYear() points at the first moment of the current year. It suits year-to-date counts and archive cleanup: anything last modified before it was not touched this year. Offsets reach earlier years, or later months within the year.

Syntax

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

Examples

created >= startOfYear()

Content created since 1 January. This is the documentation example.

Run on Confluence Cloud on .

created >= startOfYear("-1y") AND created < startOfYear()

Everything created during the previous calendar year, for an annual summary.

Run on Confluence Cloud on .

lastmodified < startOfYear() AND ancestor = 32964613 ORDER BY lastmodified ASC

Pages under the Company handbook that were not edited at all this year, oldest first. A ready archive shortlist.

Run on Confluence Cloud on .

lastmodified < startOfYear("-1y") AND type = page AND space = SD

Pages in a space untouched for the whole of last year as well, which are the safest to archive.

Run on Confluence Cloud on .

created >= startOfYear("+6M") AND created < startOfYear("+7M")

Content created in July. A positive month offset steps forward from 1 January.

Run on Confluence Cloud on .

Pitfalls

  • The year unit is lower case only. startOfYear("-1Y") fails with HTTP 500 "IllegalArgumentException executing cql", and "-1y" works.
  • The boundary moves on 1 January. A saved archive filter that lists pages in December lists a different set in the first week of the new year, so save the query and not its output.
  • lastmodified < startOfYear() counts edits of any kind, including a typo fix. A page can look active only because someone touched it once.
  • It cannot be used with a field that holds text or ids. id = startOfYear() is rejected with "Can't parse as a ContentId".

Sources

  1. CQL functions (Atlassian Developer, Confluence Cloud)

Markdown version · All CQL pages