# Metricbeat sql module fields query - change to date/time

**URL:** <https://discuss.elastic.co/t/metricbeat-sql-module-fields-query-change-to-date-time/296723>\
**Category:** Kibana\
**Created:** [February 9, 2022, 12:38pm UTC](https://discuss.elastic.co/t/metricbeat-sql-module-fields-query-change-to-date-time/296723 "2022-02-09T12:38:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garry](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@Garry](https://discuss.elastic.co/u/Garry)\
**Post date:** [February 9, 2022, 12:38pm UTC](https://discuss.elastic.co/t/metricbeat-sql-module-fields-query-change-to-date-time/296723/1 "2022-02-09T12:38:37Z")

</div>

When I ingest metricbeat sql module fields they are stored as a string.  
How can I change some of the date/time fields returned from the sql query from string to date/time to be used in Kibana?

---

<div class="post-metadata">

**Author:** ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)\
**Post date:** [March 7, 2022, 5:17pm UTC](https://discuss.elastic.co/t/metricbeat-sql-module-fields-query-change-to-date-time/296723/2 "2022-03-07T17:17:28Z")

</div>

Have you checked the Painless documentation on how to work with dates? There are quite a few examples that you may find interesting to put in a runtime field.

> **[Using Datetime in Painless | Painless Scripting Language \[master\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-datetime.html)**

---

<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 4, 2022, 5:17pm UTC](https://discuss.elastic.co/t/metricbeat-sql-module-fields-query-change-to-date-time/296723/3 "2022-04-04T17:17:58Z")

</div>

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