# Extracting time from @timestamp field using Runtime

**URL:** <https://discuss.elastic.co/t/extracting-time-from-timestamp-field-using-runtime/348468>\
**Category:** Kibana\
**Tags:** runtime\
**Created:** [December 2, 2023, 7:53am UTC](https://discuss.elastic.co/t/extracting-time-from-timestamp-field-using-runtime/348468 "2023-12-02T07:53:37Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Ethan777100](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ethan777100/32/70366_2.png) [@Ethan777100](https://discuss.elastic.co/u/Ethan777100)\
**Post date:** [December 2, 2023, 7:53am UTC](https://discuss.elastic.co/t/extracting-time-from-timestamp-field-using-runtime/348468/1 "2023-12-02T07:53:37Z")

</div>

I understand Scripted Fields have been deprecated since 7.13.

The replacement is now Runtime.

I have a `@timestamp` field  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/a/7a2f78b03e5ad7ae9e820c908c13a5ba9acaf643.png)

How can I extract out the time component into a new field `@timeofday` - such that when I filter by @timeofday, I can filter by time range.

I was reading

[Lucene Expressions Language | Elasticsearch Guide [5.0] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-scripting-expression.html#_date_field_api)

and

> **[Map a runtime field | Elasticsearch Guide \[8.11\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.11/runtime-mapping-fields.html)**

But still feel abit lost on how complicated an approach I need to do. Its actually a simple mod because I'm relying on data in existing columns to derive new ones.

**Index Management**

Since this new field is an in-line addition. @timeofday is non-existent in my Index Template.

Should I ingest more months of data (1 index per month), how can ensure this new `@timeofday` field will be calculated and included in the new data so that when I Discover, everything is seamless / consistent.

---

_[View the full topic](https://discuss.elastic.co/t/extracting-time-from-timestamp-field-using-runtime/348468)._
