# Follow-up question to "Set relative time with timestamp"

**URL:** <https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944>\
**Category:** Kibana\
**Created:** [May 16, 2020, 6:23pm UTC](https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944 "2020-05-16T18:23:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenw](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jenw](https://discuss.elastic.co/u/jenw)\
**Post date:** [May 16, 2020, 6:23pm UTC](https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944/1 "2020-05-16T18:23:36Z")

</div>

I have exactly the same problem as this user specified in this post:

> [@Set relative time with timestamp](https://discuss.elastic.co/t/set-relative-time-with-timestamp/177152):
>
> Is there a way to show the timestamp as a relative time to now? So I'm currently monitoring some services and I'm only showing the latest data for each service. I'm currently displaying the timestamp in this format: April 16th 2019, 16:31:47.375. I want to display it like: 60seconds ago or 2minutes ago. Is there a date format in Kibana that would let me do that. So [NOW-timestamp].

He provided a solution, but it is not clear to me how to specify the Language, Type and format to make the script work.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/f/2f72e4c9c973e861298ed3c715aa16f7f9648381.png)

I assume that the Language is painless, but about the other ones I am not sure.  
I have tried out several combinations, but it hasn't worked out so far.

Very thankful for any help!

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [May 18, 2020, 2:56pm UTC](https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944/2 "2020-05-18T14:56:43Z")

</div>

Painless is correct - the type should be string and the format can be left at default.

---

<div class="post-metadata">

**Author:** ![jenw](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jenw](https://discuss.elastic.co/u/jenw)\
**Post date:** [May 18, 2020, 3:18pm UTC](https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944/3 "2020-05-18T15:18:17Z")

</div>

Thank you for the answer. It doesn't work so far, but I think the problem lies somewhere else.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [May 18, 2020, 3:20pm UTC](https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944/4 "2020-05-18T15:20:30Z")

</div>

If you press the "Get help with the syntax..." link and switch to the "Preview results" tab in the flyout which opens, you can see the specific error you are hitting. Maybe the script is accessing fields that don't exist or something like that.

---

<div class="post-metadata">

**Author:** ![jenw](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jenw](https://discuss.elastic.co/u/jenw)\
**Post date:** [May 25, 2020, 1:22pm UTC](https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944/5 "2020-05-25T13:22:39Z")

</div>

Thanks for your reply. I still couldn't figure it out, because every time there is just an empty bracket in the preview.  
I also tried what is suggested here: [Getting empty value in script field in Kibana 5.2.1](https://discuss.elastic.co/t/getting-empty-value-in-script-field-in-kibana-5-2-1/104306).

Probably there is a bug in the code which we have to figure out.

Thanks a lot anyways!

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [May 26, 2020, 6:57am UTC](https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944/6 "2020-05-26T06:57:08Z")

</div>

Hm, not sure what this is about. Can you make screenshots of what you are seeing?

---

<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 23, 2020, 6:57am UTC](https://discuss.elastic.co/t/follow-up-question-to-set-relative-time-with-timestamp/232944/7 "2020-06-23T06:57:22Z")

</div>

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