CQL field
lastmodified in CQL: syntax and examples (Confluence)
lastmodified holds the date of the most recent edit of a page, comment or attachment. You use it to list what changed this week, to find stale pages, or to cut a report to a period. It is the field you sort on to see the newest or oldest changes first.
Syntax
lastmodified <operator> <date>
lastmodified <operator> <dateFunction>()
Arguments
| Argument | What it does | Optional |
|---|---|---|
date | A date or date and time in one of four formats: yyyy-MM-dd, yyyy/MM/dd, yyyy-MM-dd HH:mm, yyyy/MM/dd HH:mm. Quote it when it has a time, and it is safe to quote it always. | yes |
dateFunction | now(), startOfDay(), startOfWeek(), startOfMonth(), startOfYear(), endOfDay(), endOfWeek(), endOfMonth() or endOfYear(), with an optional offset such as "-1w". | no |
Works with
- Operators: =, !=, >, >=, <, <=
- Functions: startOfDay(), startOfWeek(), startOfMonth(), startOfYear(), endOfDay(), endOfWeek(), endOfMonth(), endOfYear(); now() also ran
- Not with: ~, !~, IN, NOT IN. The field name is not case sensitive: lastModified and lastmodified behave the same.
Examples
lastmodified >= startOfWeek() AND type = page AND space = SD ORDER BY lastmodified DESCShows the pages edited since the week began, newest first. A quick check before a Monday status meeting.
Run on Confluence Cloud on .
lastmodified < now("-1w") AND type = page AND space = SD ORDER BY lastmodified ASCLists pages nobody has touched for a week, oldest first. Change the offset to "-6M" for a real stale-content review.
Run on Confluence Cloud on .
lastmodified >= 2026-11-01 and lastmodified < "2026-11-03 09:00"Content changed from the start of the 1st until 9am on the 3rd, the same shape as the documentation example. Handy for an audit window with a time cut-off.
Run on Confluence Cloud on .
lastmodified >= startOfMonth() AND lastmodified <= endOfMonth() AND type = pagePages changed in the current month. Both ends move on their own, so the saved query stays valid next month.
Run on Confluence Cloud on .
ancestor = 32964613 AND lastmodified >= startOfWeek() AND type = page ORDER BY lastmodified DESCWhich pages under one parent, such as a handbook, were edited this week. Combines the date test with a tree filter.
Run on Confluence Cloud on .
lastModified >= 2026-11-01The same field written in camel case, as the keyword documentation spells it. It runs exactly like the lowercase form.
Run on Confluence Cloud on .
Pitfalls
- A date without a time covers the whole day.
lastmodified = 2026-11-28returns everything edited at any hour of the 28th, so a plain = on a date is usable (checked on Confluence Cloud, November 2026). - Only the four documented formats parse. Natural words fail:
lastmodified = "yesterday"and an impossible time such as"2026-11-01 25:00"both return "Could not parse cql". - IN is not accepted although it looks natural for a list of dates.
lastmodified in (2026-11-01)returns: Operator 'in' is not supported for field 'lastmodified'. Supported operators are : <, <=, >, >=, =, !=. Use two comparisons joined with AND, or ORDER BY. lastmodified ~ 2026-11-01fails with: Expecting a value for operator '~' after field 'lastmodified' but got '2026-11-01'. The ~ operator is for text, not dates.
Questions and answers
Does lastmodified use my time zone?
The documentation says results are relative to your configured time zone, which by default is the server time zone. Add a time to the date when the exact hour matters.
How do I sort by the last edit?
Add ORDER BY lastmodified DESC for newest first or ASC for oldest first, after all the conditions.