# Runtime Field Convert the Timestamp to Display Month and Year

**URL:** <https://discuss.elastic.co/t/runtime-field-convert-the-timestamp-to-display-month-and-year/330164>\
**Category:** Elasticsearch\
**Tags:** runtime-fields\
**Created:** [April 17, 2023, 8:38pm UTC](https://discuss.elastic.co/t/runtime-field-convert-the-timestamp-to-display-month-and-year/330164 "2023-04-17T20:38:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mukesh\_pallapothu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mukesh_pallapothu/32/119930_2.png) [@mukesh\_pallapothu](https://discuss.elastic.co/u/mukesh_pallapothu)\
**Post date:** [April 17, 2023, 8:38pm UTC](https://discuss.elastic.co/t/runtime-field-convert-the-timestamp-to-display-month-and-year/330164/1 "2023-04-17T20:38:52Z")

</div>

I have a requirement to show only the month and Year from the date on a Dashboard  
For instance I want to show how number of tickets by month and year - **Apr 2023**  
currently the visualization shows this as below, I want to show the values on X-axis in the format of Month Year

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/0/607d9fdb8ffbfe17674786cffae93488878dd36f.png)

I am trying to see if I can create a runtime field to get both month and year from the date, seems like there is not a function to show like that. Please advise.

---

<div class="post-metadata">

**Author:** ![mukesh\_pallapothu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mukesh_pallapothu/32/119930_2.png) [@mukesh\_pallapothu](https://discuss.elastic.co/u/mukesh_pallapothu)\
**Post date:** [April 24, 2023, 7:48pm UTC](https://discuss.elastic.co/t/runtime-field-convert-the-timestamp-to-display-month-and-year/330164/2 "2023-04-24T19:48:49Z")

</div>

All, I was able to solve this with a turnaround. I have created a runtime fields to extract month from the date and wrote a script and then selected terms in the Bars filter when showing visualization.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [April 24, 2023, 7:53pm UTC](https://discuss.elastic.co/t/runtime-field-convert-the-timestamp-to-display-month-and-year/330164/3 "2023-04-24T19:53:47Z")

</div>

@mukesh_pallapothu Welcome to the community!

And wow great that you could solve it yourself... Any chance you can share the script... it might be helpful for others! 🙂

---

<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:** [May 22, 2023, 7:53pm UTC](https://discuss.elastic.co/t/runtime-field-convert-the-timestamp-to-display-month-and-year/330164/4 "2023-05-22T19:53:56Z")

</div>

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