# Best way to handle different date formats?

**URL:** <https://discuss.elastic.co/t/best-way-to-handle-different-date-formats/159642>\
**Category:** Logstash\
**Created:** [December 6, 2018, 3:07am UTC](https://discuss.elastic.co/t/best-way-to-handle-different-date-formats/159642 "2018-12-06T03:07:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [December 6, 2018, 3:07am UTC](https://discuss.elastic.co/t/best-way-to-handle-different-date-formats/159642/1 "2018-12-06T03:07:07Z")

</div>

Hi,

I have a a bunch of .csv files but the providing party has been nice enough to use a different date format on just about every file...

Apart from using lots of if statements, is there a more practical way to have the date filter apply the date in the .csv as @timestamp?

The date format varies between yyyy/mm/dd hh:mm:ss, dd/mm/yyyy hh:mm:dd, d/mm/yyyy h:mm:ss am/pm etc.

---

<div class="post-metadata">

**Author:** ![bigphil](https://avatars.discourse-cdn.com/v4/letter/b/65b543/32.png) [@bigphil](https://discuss.elastic.co/u/bigphil)\
**Post date:** [December 6, 2018, 4:07am UTC](https://discuss.elastic.co/t/best-way-to-handle-different-date-formats/159642/2 "2018-12-06T04:07:15Z")

</div>

The "match" option on the date filter Logstash plugin takes an array input. This means you could have multiple date patterns with just one date filter in your config file. There are examples of this in the logstash documentation [here](https://www.elastic.co/guide/en/logstash/current/plugins-filters-date.html).

---

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [December 6, 2018, 4:28am UTC](https://discuss.elastic.co/t/best-way-to-handle-different-date-formats/159642/3 "2018-12-06T04:28:21Z")

</div>

Thanks. Complete read over the fact match functions as an array.

---

<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 3, 2019, 4:28am UTC](https://discuss.elastic.co/t/best-way-to-handle-different-date-formats/159642/4 "2019-01-03T04:28:30Z")

</div>

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