# Increment @timestamp with a float field

**URL:** <https://discuss.elastic.co/t/increment-timestamp-with-a-float-field/131915>\
**Category:** Logstash\
**Created:** [May 15, 2018, 10:55am UTC](https://discuss.elastic.co/t/increment-timestamp-with-a-float-field/131915 "2018-05-15T10:55:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 15, 2018, 2:19pm UTC](https://discuss.elastic.co/t/increment-timestamp-with-a-float-field/131915/2 "2018-05-15T14:19:33Z")

</div>

You want to add duration or subtract it? Anyways, you can always take the long way around...

```
  ruby {
    code => 'event.set("[@metadata][timestamp]", (event.get("@timestamp") + event.get("duration")).strftime("%Y-%m-%dT%H:%M:%S.%LZ"))'
    id => "add_duration"
  }
  date { match => ["[@metadata][timestamp]", "ISO8601" ] }
```

---

_[View the full topic](https://discuss.elastic.co/t/increment-timestamp-with-a-float-field/131915)._
