CQL function
startOfDay() in CQL: syntax and examples for Confluence
startOfDay() stands for midnight at the start of the current day. Compare created or lastmodified with it to build a morning digest of what appeared overnight or yesterday. An offset such as "-1d" or "-7d" moves the boundary back.
Syntax
startOfDay()
startOfDay("inc")
Arguments
| Argument | What it does | Optional |
|---|---|---|
inc | 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. | no |
Works with
- Fields: created, lastmodified
- Operators: =, !=, >, >=, <, <=
- Not with: ~, !~, IN, NOT IN (checked on Confluence Cloud, November 2026:
created ~ startOfDay()is rejected)
Examples
created >= startOfDay("-1d") AND created < startOfDay() AND type = pagePages created yesterday, from midnight to midnight. Two bounds make it a single calendar day, which suits a digest sent every morning.
Run on Confluence Cloud on .
lastmodified >= startOfDay() AND type = pagePages edited since midnight today. A good check before an end-of-day handover.
Run on Confluence Cloud on .
created > startOfDay("-7d")Everything created in the last seven days, today included. This is the documentation example for the offset.
Run on Confluence Cloud on .
lastmodified >= startOfDay("-1d") AND space = SD ORDER BY lastmodified DESCWhat changed in one space since yesterday morning, newest first, ready to paste into a stand-up note.
Run on Confluence Cloud on .
type = comment AND created >= startOfDay("-1d")New comments since yesterday, so nothing on a review page waits a day unnoticed.
Run on Confluence Cloud on .
Pitfalls
- The offset needs a unit.
startOfDay("-1")fails with "Invalid relative date : -1" (HTTP 400). Write"-1d". - An unknown unit letter gives HTTP 500 with "IllegalArgumentException executing cql" instead of a readable message.
"-1H"and"-1s"both do it, so hours are lower caseh. - Case matters for two letters:
"-1M"is one month back,"-1m"is one minute back. Hours are"-1h", which lands on 23:00 the previous day. - Leave the parentheses on.
lastmodified >= startOfDayis rejected with "Could not parse cql".
Questions and answers
How do I get only yesterday and not today?
Use both bounds: created >= startOfDay("-1d") AND created < startOfDay(). A single lower bound also includes today.