# lastmodified in CQL: syntax and examples (Confluence)

URL: https://goingstellar.ro/reference/cql/lastmodified-field/

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

- `date` (optional: yes): 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.
- `dateFunction` (optional: no): now(), startOfDay(), startOfWeek(), startOfMonth(), startOfYear(), endOfDay(), endOfWeek(), endOfMonth() or endOfYear(), with an optional offset such as "-1w".

## 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 DESC
```

Shows the pages edited since the week began, newest first. A quick check before a Monday status meeting. Run on Confluence Cloud on 2026-11-29.

```
lastmodified < now("-1w") AND type = page AND space = SD ORDER BY lastmodified ASC
```

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

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

```
lastmodified >= startOfMonth() AND lastmodified <= endOfMonth() AND type = page
```

Pages changed in the current month. Both ends move on their own, so the saved query stays valid next month. Run on Confluence Cloud on 2026-11-29.

```
ancestor = 32964613 AND lastmodified >= startOfWeek() AND type = page ORDER BY lastmodified DESC
```

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

```
lastModified >= 2026-11-01
```

The same field written in camel case, as the keyword documentation spells it. It runs exactly like the lowercase form. Run on Confluence Cloud on 2026-11-29.

## Pitfalls

- A date without a time covers the whole day. `lastmodified = 2026-11-28` returns 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-01` fails 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.

## Related

- [created](https://goingstellar.ro/reference/cql/created-field/)
- [startOfWeek()](https://goingstellar.ro/reference/cql/startofweek/)
- [now()](https://goingstellar.ro/reference/cql/now/)
- [ORDER BY](https://goingstellar.ro/reference/cql/order-by/)
- [>=](https://goingstellar.ro/reference/cql/greater-than-equals-operator/)
- [ancestor](https://goingstellar.ro/reference/cql/ancestor-field/)

## Sources

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

