# startOfYear() in CQL: syntax and examples for Confluence

URL: https://goingstellar.ro/reference/cql/startofyear/

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

- `inc` (optional: no): Optional 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.

## 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 2026-11-29.

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

Everything created during the previous calendar year, for an annual summary. Run on Confluence Cloud on 2026-11-29.

```
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 2026-11-29.

```
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 2026-11-29.

```
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 2026-11-29.

## 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".

## Related

- [startOfMonth()](https://goingstellar.ro/reference/cql/startofmonth/)
- [endOfYear()](https://goingstellar.ro/reference/cql/endofyear/)
- [startOfDay()](https://goingstellar.ro/reference/cql/startofday/)
- [lastmodified](https://goingstellar.ro/reference/cql/lastmodified-field/)
- [ancestor](https://goingstellar.ro/reference/cql/ancestor-field/)
- [created](https://goingstellar.ro/reference/cql/created-field/)

## Sources

- [CQL functions (Atlassian Developer, Confluence Cloud)](https://developer.atlassian.com/cloud/confluence/cql-functions/)

