# How to change timezone on painless script

**URL:** <https://discuss.elastic.co/t/how-to-change-timezone-on-painless-script/332871>\
**Category:** Kibana\
**Tags:** painless\
**Created:** [May 9, 2023, 6:32am UTC](https://discuss.elastic.co/t/how-to-change-timezone-on-painless-script/332871 "2023-05-09T06:32:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuswanul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuswanul/32/101662_2.png) [@yuswanul](https://discuss.elastic.co/u/yuswanul)\
**Post date:** [May 9, 2023, 6:32am UTC](https://discuss.elastic.co/t/how-to-change-timezone-on-painless-script/332871/1 "2023-05-09T06:32:21Z")

</div>

Hello everyone,

i want to ask something about painless script. so i just made a painless script that look like this:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/5/556c251828dbad1feb3907b471ee5e48e35b3957.png)

but unfortunately the result of this script is still in utc and i want to change it to another timezone for example GMT+7. How can i do it? what should i add on my script?

i'm using kibana v7.17

Thanks

---

<div class="post-metadata">

**Author:** ![Lisa\_Jung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lisa_jung/32/90980_2.png) [@Lisa\_Jung](https://discuss.elastic.co/u/Lisa_Jung)\
**Post date:** [May 9, 2023, 3:41pm UTC](https://discuss.elastic.co/t/how-to-change-timezone-on-painless-script/332871/2 "2023-05-09T15:41:01Z")

</div>

Hi @yuswanul !

Have you looked at this [documentation](https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-datetime.html) about using Datetime in Painless?

There is a section called Datetime Zone(screenshot included). The timezone default is UTC but it looks like you can use methods with a ZoneID to change the timezone.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/a/ea0471afcbba43842130276c9af987579d8d0c47.jpeg)

Hope this helps!

---

<div class="post-metadata">

**Author:** ![yuswanul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuswanul/32/101662_2.png) [@yuswanul](https://discuss.elastic.co/u/yuswanul)\
**Post date:** [May 10, 2023, 3:30am UTC](https://discuss.elastic.co/t/how-to-change-timezone-on-painless-script/332871/3 "2023-05-10T03:30:59Z")

</div>

oh, thanks. i've seen that documentation before but i found so many case that match my need, So I'm confused about which one to use. I have tried some of them but it doesn't work. but thanks a lot for your help

---

<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:** [June 7, 2023, 3:31am UTC](https://discuss.elastic.co/t/how-to-change-timezone-on-painless-script/332871/4 "2023-06-07T03:31:16Z")

</div>

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