# toDate in Jira Automation: convert text to a date

URL: https://goingstellar.ro/reference/smart-values/todate/

toDate turns text into a date object so you can add days, read the weekday or format it. Use it on values that arrive as text, such as changelog values, JSON fields and text custom fields. Add a pattern when the text is not in the default format.

## Syntax

```
{{text.toDate}}
{{text.toDate("yyyy MM dd")}}
```

## Arguments

- `format` (required: no): A date pattern that describes the text, for example dd/MM/yyyy

## Works on

- Fields: text values, for example summary, a text field or fieldChange.fromString
- Returns: a date at 00:00 UTC when the text has no time; empty when the text does not match

## Examples

```
{{issue.summary.replace("Hello World!","2026-12-24").toDate}}
```

Text in the default format becomes a date at midnight. The replace call stands in for a field that holds the text 2026-12-24.

Result:

```
2026-12-24T00:00:00.0+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.replace("Hello World!","2026 12 24").toDate("yyyy MM dd")}}
```

The docs pattern, used on text with spaces between the parts.

Result:

```
2026-12-24T00:00:00.0+0000
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.replace("Hello World!","24/12/2026").toDate("dd/MM/yyyy").plusDays(7).format("yyyy-MM-dd")}}
```

Parses a European date, adds a week and writes it back in ISO form.

Result:

```
2026-12-31
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.replace("Hello World!","2026-12-24").toDate.dayOfWeekName}}
```

Reads the weekday of a date held as text.

Result:

```
Thursday
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.replace("Hello World!","Dec 24, 2026").toDate("MMM d, yyyy").format("dd/MM/yyyy")}}
```

Converts a month-name format into another format.

Result:

```
24/12/2026
```

Run on Jira Cloud on 29 Nov 2026.

```
{{issue.summary.replace("Hello World!","2026-12-24T10:30:00.000+0000").toDate}}
```

Text with a time and an offset keeps its time.

Result:

```
2026-12-24T10:30:00.0+0000
```

Run on Jira Cloud on 29 Nov 2026.

## Pitfalls

- A mismatch gives an empty result, not an error. `24/12/2026` without a pattern, and `2026-12-24` with the pattern `dd/MM/yyyy`, both rendered empty (checked on Jira Cloud, November 2026).
- A quoted literal does not work as the starting point. `{{"2026-12-24".toDate}}` rendered empty, so test with a real field value or build the text with a function.
- `toDate` on a text that is not a date, such as the summary Hello World!, renders empty, and anything chained after it is empty too.
- A date field such as the due date is already a date. `{{issue.duedate.toDate}}` rendered empty (checked on Jira Cloud, November 2026); use `toDate` only on text.

## Related

- [Date formats (jiraDate, format(), shortTime…)](https://goingstellar.ro/reference/smart-values/date-format/)
- [locale() and withLocale()](https://goingstellar.ro/reference/smart-values/date-locale/)
- [setTimeZone() and convertToTimeZone()](https://goingstellar.ro/reference/smart-values/date-timezone/)
- [toStartOfDay, toCurrentTime and toDateTimeAt…](https://goingstellar.ro/reference/smart-values/tostartofday/)
- [dayOfMonth, dayOfWeekName and other date attributes](https://goingstellar.ro/reference/smart-values/date-attributes/)

## 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/)

