# withDayOfMonth() and with… setters: Jira smart values

URL: https://goingstellar.ro/reference/smart-values/date-with/

The with… functions replace one part of a date and keep the rest. Use them to snap a date to the 1st, move it to a fixed hour for a reminder, or rebuild a date in another month or year. They chain, so you can set several parts in one smart value.

## Syntax

```
{{[date].with[attribute](input)}}
{{now.withDayOfMonth(15)}}
```

## Arguments

- `input` (required: yes): The new value for that part of the date, for example a day number, a month number or an hour

## Works on

- Fields: now, created, updated and other date-time values
- Returns: the same date with that one part replaced; attributes include second, minute, hour, dayOfMonth, monthOfYear, year, dayOfYear

## Examples

```
{{now.withDayOfMonth(15)}}
```

The 15th of the current month, with the time of day kept.

Result:

```
2026-11-15T16:02:38.8+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.created.withHour(9).withMinute(0).withSecond(0)}}
```

Moves the creation time to 09:00 on the same day, a typical reminder time. The milliseconds are not cleared.

Result:

```
2026-11-29T09:00:00.5+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{now.withMonth(12).withDayOfMonth(25).format("dd MMM yyyy")}}
```

Chains two setters and then formats the result as a date for a message.

Result:

```
25 Dec 2026
```

Run on Jira Cloud on 29 Nov 2026.

```
{{now.withYear(2030).withDayOfYear(1).format("yyyy-MM-dd")}}
```

Builds the first day of 2030 from today's date.

Result:

```
2030-01-01
```

Run on Jira Cloud on 29 Nov 2026.

```
{{now.withDayOfYear(355)}}
```

The 355th day of the current year, taken straight from the docs.

Result:

```
2026-12-21T16:02:39.0+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.duedate.withDayOfMonth(1)}}
```

On a due date of 2026-12-15, the first day of the due month. A date-only field stays date-only.

Result:

```
2026-12-01
```

Run on Jira Cloud on 29 Nov 2026.

## Pitfalls

- A value that does not exist is an error, not a rounding. `{{now.withDayOfMonth(31)}}` in a 30-day month, `withDayOfMonth(0)` and `withMonth(13)` all failed with "Failed to get value" (checked on Jira Cloud, November 2026). Use `endOfMonth` when you want the last day.
- Time setters need a time. `{{issue.duedate.withHour(17)}}` rendered empty because a due date has no time of day (checked on Jira Cloud, November 2026).
- With the day-of-year setter, the result depends on the year: the docs show day 355 as 20 December for a leap year, while 2026 gives 21 December.
- `withDayOfWeek(1)` rendered empty. To land on a weekday, use `withNextDayOfWeek` instead.

## Related

- [withNextDayOfWeek()](https://goingstellar.ro/reference/smart-values/withnextdayofweek/)
- [startOfMonth and endOfMonth](https://goingstellar.ro/reference/smart-values/startofmonth-endofmonth/)
- [firstOfTheMonth(), lastOfTheMonth(), ofTheMonth()](https://goingstellar.ro/reference/smart-values/firstofthemonth-lastofthemonth/)
- [plusDays() / minusDays() and other units](https://goingstellar.ro/reference/smart-values/date-plus-minus/)
- [Date formats (jiraDate, format(), shortTime…)](https://goingstellar.ro/reference/smart-values/date-format/)
- [toStartOfDay, toCurrentTime and toDateTimeAt…](https://goingstellar.ro/reference/smart-values/tostartofday/)

## Sources

- [Jira smart values: date and time (Atlassian Support)](https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/)
- [Use smart values to manipulate and format dates (Atlassian Support)](https://support.atlassian.com/cloud-automation/docs/examples-of-using-smart-values-with-dates/)

