# Convert mytimestamp to @timestamp

**URL:** https://discuss.elastic.co/t/convert-mytimestamp-to-timestamp/110921
**Category:** Logstash
**Created:** [December 9, 2017, 8:26am UTC](https://discuss.elastic.co/t/convert-mytimestamp-to-timestamp/110921 "2017-12-09T08:26:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Vivek\_Nigam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_nigam/32/25094_2.png) [@Vivek\_Nigam](https://discuss.elastic.co/u/Vivek_Nigam)
#### Post date: [December 9, 2017, 8:26am UTC](https://discuss.elastic.co/t/convert-mytimestamp-to-timestamp/110921/1 "2017-12-09T08:26:39Z")

</div>

i want to convert mytimestamp to @timestamp

i merge two string field to mytimestamp field. now i want to convert this field to date & target to @timestamp.

My code:

add\_field =\> {  
"mytimestamp" =\> "%{filedate} %{MyTimeStamp}"  
}  
convert =\> { "mytimeStamp" =\> "date" }

}

date {  
match =\> ["mytimestamp", "MM-dd-yyyy HH:mm:ss,SSS"]  
target =\> "@timestamp"  
}

getting logstash error on above change.

help me on this.

---

<div class="post-metadata">

### Author: ![Vivek\_Nigam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_nigam/32/25094_2.png) [@Vivek\_Nigam](https://discuss.elastic.co/u/Vivek_Nigam)
#### Post date: [December 9, 2017, 9:02am UTC](https://discuss.elastic.co/t/convert-mytimestamp-to-timestamp/110921/2 "2017-12-09T09:02:12Z")

</div>

field mytimestamp is string field:

output is:

"mytimestamp" =\> "12082017 23:24:01.095", need to convert in @timestamp

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [December 9, 2017, 9:33am UTC](https://discuss.elastic.co/t/convert-mytimestamp-to-timestamp/110921/3 "2017-12-09T09:33:06Z")

</div>

> [@Vivek\_Nigam](#):
>
> "12082017 23:24:01.095"

This does not match the specified date format `MM-dd-yyyy HH:mm:ss,SSS`. Instead try `MMddyyyy HH:mm:ss.SSS`.

---

<div class="post-metadata">

### Author: ![Vivek\_Nigam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_nigam/32/25094_2.png) [@Vivek\_Nigam](https://discuss.elastic.co/u/Vivek_Nigam)
#### Post date: [December 10, 2017, 2:54am UTC](https://discuss.elastic.co/t/convert-mytimestamp-to-timestamp/110921/4 "2017-12-10T02:54:14Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> MMddyyyy HH:mm:ss.SSS

Thanks it works.

---

<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: [January 7, 2018, 2:54am UTC](https://discuss.elastic.co/t/convert-mytimestamp-to-timestamp/110921/5 "2018-01-07T02:54:39Z")

</div>

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