# firstOfTheMonth() and lastOfTheMonth(): Jira smart values

URL: https://goingstellar.ro/reference/smart-values/firstofthemonth-lastofthemonth/

These functions pick a weekday inside the month of a date. firstOfTheMonth gives the first such weekday, lastOfTheMonth the last one and ofTheMonth the nth one. Use them for rules such as a review on the first Monday or a report on the last Friday.

## Syntax

```
{{[date].firstOfTheMonth(input)}}
{{[date].lastOfTheMonth(input)}}
{{[date].ofTheMonth(n, day)}}
```

## Arguments

- `input / day` (required: yes): Weekday number: 1 Monday, 2 Tuesday, 3 Wednesday, 4 Thursday, 5 Friday, 6 Saturday, 7 Sunday
- `n` (required: yes (ofTheMonth)): Which occurrence in the month, for example 2 for the second

## Works on

- Fields: now, created, duedate and other date values
- Returns: the matching day in the month of the given date, with the time of day kept

## Examples

```
{{now.firstOfTheMonth(1)}}
```

The first Monday of November 2026.

Result:

```
2026-11-02T16:02:39.3+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{now.plusMonths(1).firstOfTheMonth(1)}}
```

The first Monday of next month: shift the month first, then pick the weekday.

Result:

```
2026-12-07T16:18:31.4+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{now.lastOfTheMonth(5)}}
```

The last Friday of the current month.

Result:

```
2026-11-27T16:02:39.3+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{now.ofTheMonth(2, 1)}}
```

The second Monday of the month.

Result:

```
2026-11-09T16:02:39.4+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.duedate.lastOfTheMonth(5).format("dd MMM yyyy")}}
```

The last Friday of the month of a due date, in a readable format.

Result:

```
25 Dec 2026
```

Run on Jira Cloud on 29 Nov 2026.

```
{{now.firstOfTheMonth(1).toStartOfDay.format("yyyy-MM-dd")}}
```

The first Monday as a plain date for a comment or a field.

Result:

```
2026-11-02
```

Run on Jira Cloud on 29 Nov 2026.

## Pitfalls

- The weekday argument is a number from 1 to 7. `firstOfTheMonth(8)` and `firstOfTheMonth(0)` failed with "Failed to get value", and `firstOfTheMonth("MON")` rendered empty (checked on Jira Cloud, November 2026).
- `ofTheMonth` needs both arguments. `{{now.ofTheMonth(2)}}` rendered empty (checked on Jira Cloud, November 2026).
- Asking for an occurrence that does not exist did not fail. `{{now.ofTheMonth(5, 2)}}` in November 2026, which has only four Tuesdays, gave the last Tuesday, the 24th (checked on Jira Cloud, November 2026).
- The docs write the third function as `OfTheMonth` in the heading and `ofTheMonth` in the example. Use the lowercase form from the example.

## Related

- [withNextDayOfWeek()](https://goingstellar.ro/reference/smart-values/withnextdayofweek/)
- [startOfMonth and endOfMonth](https://goingstellar.ro/reference/smart-values/startofmonth-endofmonth/)
- [withDayOfMonth(), withMonth() and other with… setters](https://goingstellar.ro/reference/smart-values/date-with/)
- [toBusinessDay(), plusBusinessDays() and business-day helpers](https://goingstellar.ro/reference/smart-values/business-days/)
- [plusDays() / minusDays() and other units](https://goingstellar.ro/reference/smart-values/date-plus-minus/)

## Sources

- [Jira smart values: date and time (Atlassian Support)](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/)

