# Scripted field for date + 12 months

**URL:** https://discuss.elastic.co/t/scripted-field-for-date-12-months/328715
**Category:** Kibana
**Created:** [March 28, 2023, 1:36pm UTC](https://discuss.elastic.co/t/scripted-field-for-date-12-months/328715 "2023-03-28T13:36:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![redfox](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@redfox](https://discuss.elastic.co/u/redfox)
#### Post date: [March 28, 2023, 1:36pm UTC](https://discuss.elastic.co/t/scripted-field-for-date-12-months/328715/1 "2023-03-28T13:36:54Z")

</div>

How would I create a scripted field in Kibana that adds 12 months to the value in existing date field in the index?

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [March 29, 2023, 3:08pm UTC](https://discuss.elastic.co/t/scripted-field-for-date-12-months/328715/2 "2023-03-29T15:08:35Z")

</div>

What is you intended use of the script field?

You may use [painless scripting language](https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-datetime.html#_datetime_modification) to create such field, but there may be an easier/more efficient way depending on your purpose.

---

<div class="post-metadata">

### Author: ![redfox](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@redfox](https://discuss.elastic.co/u/redfox)
#### Post date: [March 30, 2023, 12:30pm UTC](https://discuss.elastic.co/t/scripted-field-for-date-12-months/328715/3 "2023-03-30T12:30:44Z")

</div>

I've an ask from a team to help them forecast the expiry of a certain status within our dataset but we don't store the expiry date so I need to calculate it so that I can then build a lens that shows how many entities are expiring next month, in 2 months, 3 months, 4 months etc etc

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 27, 2023, 12:31pm UTC](https://discuss.elastic.co/t/scripted-field-for-date-12-months/328715/4 "2023-04-27T12:31:21Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
