# Convert timestamp field from yyyy-MM-dd HH:mm:ss to yyyy-MM-dd HH:mm:ss.SSS

**URL:** <https://discuss.elastic.co/t/convert-timestamp-field-from-yyyy-mm-dd-hh-mm-ss-to-yyyy-mm-dd-hh-mm-ss-sss/111671>\
**Category:** Logstash\
**Created:** [December 14, 2017, 1:25am UTC](https://discuss.elastic.co/t/convert-timestamp-field-from-yyyy-mm-dd-hh-mm-ss-to-yyyy-mm-dd-hh-mm-ss-sss/111671 "2017-12-14T01:25:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmadera\_rp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cmadera_rp/32/31250_2.png) [@cmadera\_rp](https://discuss.elastic.co/u/cmadera_rp)\
**Post date:** [December 14, 2017, 1:25am UTC](https://discuss.elastic.co/t/convert-timestamp-field-from-yyyy-mm-dd-hh-mm-ss-to-yyyy-mm-dd-hh-mm-ss-sss/111671/1 "2017-12-14T01:25:01Z")

</div>

Hello I have a logstash input from amazon kinesis than one field "news\_timestamp" have an timestamp with this format "yyyy-MM-dd HH:mm:ss"

I need to update this field adding the milliseconds .000 like this "yyyy-MM-dd HH:mm:ss.SSS"

how I can do this, im using elasticsearch 6.x and logstash 6.x,

thanks for advance

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 18, 2017, 7:04pm UTC](https://discuss.elastic.co/t/convert-timestamp-field-from-yyyy-mm-dd-hh-mm-ss-to-yyyy-mm-dd-hh-mm-ss-sss/111671/2 "2017-12-18T19:04:02Z")

</div>

You can use a mutate filter to either

- use gsub to substitute the end of the string (`$`) with ".000" or
- use the replace option to set the field's value to "%{news\_timestamp}.000".

---

<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 15, 2018, 7:04pm UTC](https://discuss.elastic.co/t/convert-timestamp-field-from-yyyy-mm-dd-hh-mm-ss-to-yyyy-mm-dd-hh-mm-ss-sss/111671/3 "2018-01-15T19:04:12Z")

</div>

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