# I need to transform String field with numbers in format (yyyyddmmHHMM) to a Date field

**URL:** <https://discuss.elastic.co/t/i-need-to-transform-string-field-with-numbers-in-format-yyyyddmmhhmm-to-a-date-field/266727>\
**Category:** Kibana\
**Created:** [March 9, 2021, 5:08pm UTC](https://discuss.elastic.co/t/i-need-to-transform-string-field-with-numbers-in-format-yyyyddmmhhmm-to-a-date-field/266727 "2021-03-09T17:08:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonhmb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonhmb/32/82993_2.png) [@jonhmb](https://discuss.elastic.co/u/jonhmb)\
**Post date:** [March 9, 2021, 5:08pm UTC](https://discuss.elastic.co/t/i-need-to-transform-string-field-with-numbers-in-format-yyyyddmmhhmm-to-a-date-field/266727/1 "2021-03-09T17:08:11Z")

</div>

I have logs from a Jenkins application and I need this LastCommitDate to be really a date, but it is a String ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/3/93a7d6d29e6af375981ef7633cf97e0d4aed7c13.png)

How can i transform it to a Date field?  
I need to transform even the past logs, so it will propably be needed to reindex but how to do it?

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [March 9, 2021, 5:17pm UTC](https://discuss.elastic.co/t/i-need-to-transform-string-field-with-numbers-in-format-yyyyddmmhhmm-to-a-date-field/266727/2 "2021-03-09T17:17:03Z")

</div>

You can change the [mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html) for that field to type `date` and give it a `format` that matches your date string.

You will need to reindex or reingest your data once your mapping has changed.

---

<div class="post-metadata">

**Author:** ![jonhmb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonhmb/32/82993_2.png) [@jonhmb](https://discuss.elastic.co/u/jonhmb)\
**Post date:** [March 9, 2021, 5:44pm UTC](https://discuss.elastic.co/t/i-need-to-transform-string-field-with-numbers-in-format-yyyyddmmhhmm-to-a-date-field/266727/3 "2021-03-09T17:44:38Z")

</div>

Could you please give me an example for this?

---

<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 6, 2021, 5:44pm UTC](https://discuss.elastic.co/t/i-need-to-transform-string-field-with-numbers-in-format-yyyyddmmhhmm-to-a-date-field/266727/4 "2021-04-06T17:44:38Z")

</div>

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