Going Stellar

Home/JQL reference

JQL function

startOfMonth() in JQL: syntax and examples

startOfMonth() stands for the first moment of the current month. It fits monthly reports, month-to-date counts and comparisons with the previous month. Offsets move it by months, or by days when you give a unit.

Syntax

startOfMonth()
startOfMonth("inc")

Arguments

ArgumentWhat it doesOptional
incOptional offset in the form (+/-)nn(y|M|w|d|h|m). With no unit it counts months, so "-1" is the same as "-1M". With no sign, plus is assumed.yes

Works with

  • Fields: Created, Due, Resolved, Updated, custom Date or Date/Time fields
  • Operators: =, !=, >, >=, <, <=, and inside WAS, WAS IN, WAS NOT, WAS NOT IN, CHANGED predicates
  • Not with: ~, !~, IS, IS NOT, IN, NOT IN

Examples

project in (WEB, MOB) AND created >= startOfMonth() ORDER BY created DESC

Month-to-date intake for two projects, newest first. A good base for a monthly intake gadget.

Run on Jira Cloud on .

created >= startOfMonth("-1") AND created < startOfMonth()

Everything created during the previous calendar month. Both bounds are needed, otherwise the current month is included.

Run on Jira Cloud on .

resolved >= startOfMonth() AND resolution is not EMPTY ORDER BY resolved DESC

Work closed this month, latest first. Empty early in the month, which is expected.

Run on Jira Cloud on .

created >= startOfMonth("+14d")

From the 15th of the current month. Adding 14 days to the 1st lands on the 15th, a split used for mid-month check-ins.

Run on Jira Cloud on .

project = MOB AND statusCategory != Done AND updated < startOfMonth() ORDER BY updated ASC

Open work in one project that nobody touched since before this month began.

Run on Jira Cloud on .

Pitfalls

  • Case matters in the offset. "-1M" is one month, "-1m" is one minute, so created >= startOfMonth("-1m") is a one-minute shift, not last month.
  • startOfMonth("-1") gives the first day of last month, not the same date a month ago. It never depends on today's day number.
  • On a date field such as due date there is no time part, so the boundary is simply the first date. For created and updated it is midnight in the time zone of the person who runs the search.
  • It cannot fill a list. status in (startOfMonth()) fails with "A value provided by the function 'startOfMonth' is invalid for the field 'status'."

Ready-made queries

Questions and answers

How do I get last month's work items in JQL?

Use two bounds: created >= startOfMonth("-1") AND created < startOfMonth(). The same pair works for resolved and updated.

Sources

  1. JQL functions (Atlassian Support, Jira Cloud)

Markdown version · All JQL pages