# Conversion two string to date

**URL:** <https://discuss.elastic.co/t/conversion-two-string-to-date/135739>\
**Category:** Logstash\
**Created:** [June 13, 2018, 1:44pm UTC](https://discuss.elastic.co/t/conversion-two-string-to-date/135739 "2018-06-13T13:44:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmed\_charafouddine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmed_charafouddine/32/45129_2.png) [@ahmed\_charafouddine](https://discuss.elastic.co/u/ahmed_charafouddine)\
**Post date:** [June 13, 2018, 1:44pm UTC](https://discuss.elastic.co/t/conversion-two-string-to-date/135739/1 "2018-06-13T13:44:11Z")

</div>

Hello everyone,

Having two cords:  
date = 201808612  
hour = 1234  
is there a way to replace it with the @timestamp with the logstash date module.

Thanks

---

<div class="post-metadata">

**Author:** ![CDR](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@CDR](https://discuss.elastic.co/u/CDR)\
**Post date:** [June 13, 2018, 1:50pm UTC](https://discuss.elastic.co/t/conversion-two-string-to-date/135739/2 "2018-06-13T13:50:16Z")

</div>

Are you saying that you want to have the date and hour be used as @timestamp?  
Also, is the hour field the time of day?

---

<div class="post-metadata">

**Author:** ![ahmed\_charafouddine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmed_charafouddine/32/45129_2.png) [@ahmed\_charafouddine](https://discuss.elastic.co/u/ahmed_charafouddine)\
**Post date:** [June 13, 2018, 1:57pm UTC](https://discuss.elastic.co/t/conversion-two-string-to-date/135739/3 "2018-06-13T13:57:27Z")

</div>

> [@CDR](#):
>
> Are you saying that you want to have the date and hour be used as @timestamp?  
> Also, is the hour field the time of day?

I am in the situation where I have a field named date (string) and time (string) and I wanted to replace it with the @timpstamp

---

<div class="post-metadata">

**Author:** ![CDR](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@CDR](https://discuss.elastic.co/u/CDR)\
**Post date:** [June 13, 2018, 2:26pm UTC](https://discuss.elastic.co/t/conversion-two-string-to-date/135739/4 "2018-06-13T14:26:08Z")

</div>

Well I think you have two options here.

1. You could modify the groks so that the date and time fields are parsed out as a single string. Then you would use the date plugin which replaces it as the @timestamp.
2. You could use the mutate to add a field which combines the two fields into a single field called datetime. Then you would use the newly created field and the date plugin to replace it as the @timestamp.

Here are some useful links:  
[https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html)  
[https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html)

---

<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 11, 2018, 2:26pm UTC](https://discuss.elastic.co/t/conversion-two-string-to-date/135739/5 "2018-07-11T14:26:25Z")

</div>

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