# Add extra timestamp field for local time

**URL:** <https://discuss.elastic.co/t/add-extra-timestamp-field-for-local-time/83510>\
**Category:** Logstash\
**Created:** [April 25, 2017, 8:01am UTC](https://discuss.elastic.co/t/add-extra-timestamp-field-for-local-time/83510 "2017-04-25T08:01:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kernelpanic](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@kernelpanic](https://discuss.elastic.co/u/kernelpanic)\
**Post date:** [April 25, 2017, 8:01am UTC](https://discuss.elastic.co/t/add-extra-timestamp-field-for-local-time/83510/1 "2017-04-25T08:01:09Z")

</div>

Hello, I understand that Elasticsearch stores timestamp in UTC format internally, which are an hour behind my local time (UK time). I would like to add a field that shows the correct local time, am I right in thinking I need to do something with a Ruby filter as in this post:

> [@Convert @timestamp to epoch](https://discuss.elastic.co/t/convert-timestamp-to-epoch/64522):
>
> Hi, I need to convert @timestamp to epoch and add this new field to the event. So far I can only add a new field with the content of "@timestamp". filter { mutate { add\_field =\> ["epochtime", "%{@timestamp}"] } } I'm sure this will be an easy fix although I can't find anything to lead me to my answer. Please assist. Thank you, Rivaan

...or is there a simpler way to do it?

Thanks.

---

<div class="post-metadata">

**Author:** ![kernelpanic](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@kernelpanic](https://discuss.elastic.co/u/kernelpanic)\
**Post date:** [April 25, 2017, 5:14pm UTC](https://discuss.elastic.co/t/add-extra-timestamp-field-for-local-time/83510/2 "2017-04-25T17:14:40Z")

</div>

I think the code would be something like:

```
filter {
    ruby {
        code => "event['local_time'] = event['@timestamp'].localtime('+01:00')"
    }
}

```

But I'm unsure how to get that value in a new field

---

<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 23, 2017, 5:17pm UTC](https://discuss.elastic.co/t/add-extra-timestamp-field-for-local-time/83510/3 "2017-05-23T17:17:09Z")

</div>

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