# Changing Date Format in logstash

**URL:** <https://discuss.elastic.co/t/changing-date-format-in-logstash/123206>\
**Category:** Logstash\
**Created:** [March 9, 2018, 6:42am UTC](https://discuss.elastic.co/t/changing-date-format-in-logstash/123206 "2018-03-09T06:42:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Janardhan\_Randhi](https://avatars.discourse-cdn.com/v4/letter/j/a88e4f/32.png) [@Janardhan\_Randhi](https://discuss.elastic.co/u/Janardhan_Randhi)\
**Post date:** [March 9, 2018, 6:42am UTC](https://discuss.elastic.co/t/changing-date-format-in-logstash/123206/1 "2018-03-09T06:42:41Z")

</div>

How can i delete the t and z date format in elastic search using through logstash.

my input is :2017-05-08 07:27:03.121 after push into elastic search its shows like 2017-05-08T07:27:03.121Z  
format ,how can i remove the T and Z in time format while push into elastic using logstash.

Excepted output is :2017-05-08 07:27:03.121

---

<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:** [March 9, 2018, 7:09am UTC](https://discuss.elastic.co/t/changing-date-format-in-logstash/123206/2 "2018-03-09T07:09:00Z")

</div>

The output format of the date filter isn't configurable. If you really want to produce a timestamp in a different format you can use a ruby filter.

I think you're spending your time on the wrong problem. The raw value should never be displayed to users and the current format is a standard format that's unambiguous and that any piece of software can parse. Both the T and the Z are there for a reason. In fact, removing the Z without adjusting the rest of the timestamp would make it incorrect unless the local timezone happent to be GMT.

---

<div class="post-metadata">

**Author:** ![Janardhan\_Randhi](https://avatars.discourse-cdn.com/v4/letter/j/a88e4f/32.png) [@Janardhan\_Randhi](https://discuss.elastic.co/u/Janardhan_Randhi)\
**Post date:** [March 9, 2018, 11:17am UTC](https://discuss.elastic.co/t/changing-date-format-in-logstash/123206/3 "2018-03-09T11:17:03Z")

</div>

Yeah, thank you!!! But I am facing problem when retrieving it through java using Jest client. What is the timestamp format we have to use in java to retrieve time stamp from elastic search.

---

<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:** [March 9, 2018, 1:04pm UTC](https://discuss.elastic.co/t/changing-date-format-in-logstash/123206/4 "2018-03-09T13:04:35Z")

</div>

You mean how to turn the string 2017-05-08T07:27:03.121Z into e.g. a java.util.Date object? I don't know, look for an ISO8601 parser.

---

<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:** [April 6, 2018, 1:04pm UTC](https://discuss.elastic.co/t/changing-date-format-in-logstash/123206/5 "2018-04-06T13:04:54Z")

</div>

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