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

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

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

- `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 ~ startOfDay()` is rejected)

## Examples

```
created >= startOfDay("-1d") AND created < startOfDay() AND type = page
```

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

```
lastmodified >= startOfDay() AND type = page
```

Pages edited since midnight today. A good check before an end-of-day handover. Run on Confluence Cloud on 2026-11-29.

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

```
lastmodified >= startOfDay("-1d") AND space = SD ORDER BY lastmodified DESC
```

What changed in one space since yesterday morning, newest first, ready to paste into a stand-up note. Run on Confluence Cloud on 2026-11-29.

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

## 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 case `h`.
- 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 >= startOfDay` is 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.

## Related

- [startOfWeek()](https://goingstellar.ro/reference/cql/startofweek/)
- [endOfDay()](https://goingstellar.ro/reference/cql/endofday/)
- [startOfMonth()](https://goingstellar.ro/reference/cql/startofmonth/)
- [now()](https://goingstellar.ro/reference/cql/now/)
- [created](https://goingstellar.ro/reference/cql/created-field/)
- [lastmodified](https://goingstellar.ro/reference/cql/lastmodified-field/)

## Sources

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

