# Logstash date parse failure - ruby exception

**URL:** https://discuss.elastic.co/t/logstash-date-parse-failure-ruby-exception/333710
**Category:** Logstash
**Created:** [May 18, 2023, 4:08am UTC](https://discuss.elastic.co/t/logstash-date-parse-failure-ruby-exception/333710 "2023-05-18T04:08:57Z")
**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 18, 2023, 4:18am UTC](https://discuss.elastic.co/t/logstash-date-parse-failure-ruby-exception/333710/2 "2023-05-18T04:18:36Z")

</div>

> [@sai\_ravi\_shankar](#):
>
> ```auto
> zz = DateTime.new(event_time[0,4].to_i,event_time[4,2].to_i,event_time[6,2].to_i,event_time[8,2].to_i,event_time[10,2].to_i,event_time[12,2].to_i)
> event.set("@timestamp",zz)
> 
> ```

If you want to event.set [@timestamp] then feed it a Time object, not a DateTime object. [Here](https://discuss.elastic.co/t/how-to-replace-timestamp-field-in-logstash-aggregate-filter-map/275708/2), for example. I believe the constructor will do the work for you in that case.

---

_[View the full topic](https://discuss.elastic.co/t/logstash-date-parse-failure-ruby-exception/333710)._
