# Timestamp field with local timezone!

**URL:** <https://discuss.elastic.co/t/timestamp-field-with-local-timezone/160238>\
**Category:** Logstash\
**Created:** [December 10, 2018, 7:54pm UTC](https://discuss.elastic.co/t/timestamp-field-with-local-timezone/160238 "2018-12-10T19:54:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![admlko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/admlko/32/21787_2.png) [@admlko](https://discuss.elastic.co/u/admlko)\
**Post date:** [December 11, 2018, 10:19am UTC](https://discuss.elastic.co/t/timestamp-field-with-local-timezone/160238/2 "2018-12-11T10:19:40Z")

</div>

Yeah, I think you have to use ruby filter in order to accomplish what you want.

If I have understood correctly, you need to use 'tzinfo' rubygem in order to handle timezones the way you want to.

So, here's something to push you in the right direction.

```auto
  ruby {
    init => "['date', 'tzinfo'].each(&method(:require))"
    code => "
      tz = TZInfo::Timezone.get('Europe/Helsinki')
      local = tz.utc_to_local(Time.at(event.get('epoch_time_integer_field')))
      event.set('localtime', local.to_s)
      event.set('timezone', tz.to_s)
    "
  }

```

This is completely untested and my ruby skills are close to zero, but it should be enough to give you an idea how to achive your goal. I also have no idea in which format you would like to save the local time etc etc.

Please note, that you need to deliver tzinfo gem to Logstash by yourself.

---

_[View the full topic](https://discuss.elastic.co/t/timestamp-field-with-local-timezone/160238)._
