# Change Date format from yyyy-MM-dd hh:mm:ss to yyyy-MM-dd

**URL:** <https://discuss.elastic.co/t/change-date-format-from-yyyy-mm-dd-hhss-to-yyyy-mm-dd/162306>\
**Category:** Logstash\
**Created:** [December 28, 2018, 7:05am UTC](https://discuss.elastic.co/t/change-date-format-from-yyyy-mm-dd-hhss-to-yyyy-mm-dd/162306 "2018-12-28T07:05:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vsingh](https://avatars.discourse-cdn.com/v4/letter/v/b4bc9f/32.png) [@vsingh](https://discuss.elastic.co/u/vsingh)\
**Post date:** [December 28, 2018, 7:05am UTC](https://discuss.elastic.co/t/change-date-format-from-yyyy-mm-dd-hhss-to-yyyy-mm-dd/162306/1 "2018-12-28T07:05:57Z")

</div>

Hello there,

I am using logstash logstash-6.4.0.  
I have mysql req\_date column which format is yyyy-MM-dd hh:mm:ss. i want to change this format into yyyy-MM-dd.  
Input (mysql req\_date column): 2017-05-31 00:00:00.000  
Expected in elastic search: 2017-05-31

filter {  
if [type] == "response" {  
date {  
match =\> ["req\_date", "yyyy-MM-dd hh:mm:ss"]  
target =\> "log\_day"  
}  
date\_formatter {  
source =\> "log\_day"  
pattern =\> "yyyy-MM-dd"  
}  
}  
}

It gives the error:  
"Couldn't find any filter plugin named 'date\_formatter'.

please suggest.

Thanks.

---

<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 29, 2018, 9:03am UTC](https://discuss.elastic.co/t/change-date-format-from-yyyy-mm-dd-hhss-to-yyyy-mm-dd/162306/2 "2018-12-29T09:03:14Z")

</div>

I have never heard of a plugin named `date_formatter`. Where did you come across this?

All timestamps in Elasticsearch include a time component, so the formatted date would probably have to be mapped as a string. The `log_day` field will be converted into UTC timezone. Do you want the pure date based on the original value or the one in UTC?

---

<div class="post-metadata">

**Author:** ![vsingh](https://avatars.discourse-cdn.com/v4/letter/v/b4bc9f/32.png) [@vsingh](https://discuss.elastic.co/u/vsingh)\
**Post date:** [January 2, 2019, 7:02am UTC](https://discuss.elastic.co/t/change-date-format-from-yyyy-mm-dd-hhss-to-yyyy-mm-dd/162306/3 "2019-01-02T07:02:01Z")

</div>

Thanks for reply.

I found something about date\_formatter on this post:

> <https://stackoverflow.com/questions/32969886/converting-date-format-to-yyyy-mm-dd-from-yyyy-mm-dd-hhmmss-format-in-logstash>

anyway, i have date column req\_date: 2017-09-29T18:30:00.000Z.  
i want 2017-09-29 in req\_date date column. it should be date type. i want to remove timezone.

Thanks.

---

<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:** [January 2, 2019, 7:28am UTC](https://discuss.elastic.co/t/change-date-format-from-yyyy-mm-dd-hhss-to-yyyy-mm-dd/162306/4 "2019-01-02T07:28:29Z")

</div>

Dates are represented as timestamps in Elasticsearch, so will have a time component and must be in UTC timezone.

---

<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 30, 2019, 7:28am UTC](https://discuss.elastic.co/t/change-date-format-from-yyyy-mm-dd-hhss-to-yyyy-mm-dd/162306/5 "2019-01-30T07:28:30Z")

</div>

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