# Epoch to readable timestamp

**URL:** https://discuss.elastic.co/t/epoch-to-readable-timestamp/269623
**Category:** Logstash
**Created:** [April 8, 2021, 4:32pm UTC](https://discuss.elastic.co/t/epoch-to-readable-timestamp/269623 "2021-04-08T16:32:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gneves](https://avatars.discourse-cdn.com/v4/letter/g/3da27b/32.png) [@gneves](https://discuss.elastic.co/u/gneves)
#### Post date: [April 8, 2021, 4:32pm UTC](https://discuss.elastic.co/t/epoch-to-readable-timestamp/269623/1 "2021-04-08T16:32:52Z")

</div>

Hello guys. Hope you are doing well.  
Im having a little problem trying to convert an event time in epoch to a readable timestamp, per example in UTC.

So, the log that i have is something like this:

```auto
 event_time=1613523594666851230

```

So, i did apply a filter like this to my logstash config:

```auto
     mutate {
       convert => { "event_time" => "string"}
       }
       date {
       match => ["event_time","UNIX_MS"]
       target => "event_time"
       timezone => "UTC"
       tag_on_failure => [" "]
       }

```

And then im getting the event time showing up like this, completely wrong:

```auto
event_time : 51132497-04-06T22:34:11.230Z

```

Hopefully you can help me, thank you for your time 🙂 .

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [April 8, 2021, 5:51pm UTC](https://discuss.elastic.co/t/epoch-to-readable-timestamp/269623/2 "2021-04-08T17:51:52Z")

</div>

> [@gneves](#):
>
> `1613523594666851230`

Your timestamp is in nanoseconds, not milliseconds. You could try

```
ruby { code => 'event.set("event_time", event.get("event_time").to_f/1000000)' }

```

---

<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 6, 2021, 5:52pm UTC](https://discuss.elastic.co/t/epoch-to-readable-timestamp/269623/3 "2021-05-06T17:52:23Z")

</div>

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