# Scripted Field using timestamp

**URL:** https://discuss.elastic.co/t/scripted-field-using-timestamp/238106
**Category:** Elasticsearch
**Created:** [June 22, 2020, 2:55pm UTC](https://discuss.elastic.co/t/scripted-field-using-timestamp/238106 "2020-06-22T14:55:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Brpat](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@Brpat](https://discuss.elastic.co/u/Brpat)
#### Post date: [June 22, 2020, 2:55pm UTC](https://discuss.elastic.co/t/scripted-field-using-timestamp/238106/1 "2020-06-22T14:55:09Z")

</div>

Hello, I'm new to Elastic, and I've been trying to create a custom dashboard that will show user activity after hours. I wanted to create a scripted field to filter by hour of day and I found this post [Kibana Filter for a specific time range](https://discuss.elastic.co/t/kibana-filter-for-a-specific-time-range/105169), however I want to use timestamp instead of @timestamp as mentioned in that post as we don't use the @timestamp field.

Additional info , we ship logs using Filebeat and not Logstash to Elasticsearch.

I wanted to extract the hour from the timestamp data using the below value

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

Something like

`doc['timestamp'].date.hourOfDay - 4` for UTC−04:00

but that is causing index errors.

---

<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: [July 20, 2020, 2:55pm UTC](https://discuss.elastic.co/t/scripted-field-using-timestamp/238106/2 "2020-07-20T14:55:12Z")

</div>

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