# Date filter ISO 8601

**URL:** <https://discuss.elastic.co/t/date-filter-iso-8601/144365>\
**Category:** Logstash\
**Created:** [August 14, 2018, 3:28pm UTC](https://discuss.elastic.co/t/date-filter-iso-8601/144365 "2018-08-14T15:28:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken\_Leoni](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@Ken\_Leoni](https://discuss.elastic.co/u/Ken_Leoni)\
**Post date:** [August 14, 2018, 3:28pm UTC](https://discuss.elastic.co/t/date-filter-iso-8601/144365/1 "2018-08-14T15:28:57Z")

</div>

I'm doing something which I thought should be simple.. but can't get it to work for the life of me.. I'm doing a jdbc query.. and my data has a sampletime in the record that I want to use the the timestamp.. this is what I've in .conf

I've tried all the formatting options including, "yyyy-MM-dd'T'HH:mm:ss.SSSZ"

filter {  
date {  
match =\> ["sampletime", "ISO8601"]  
target =\> "@timestamp"  
}  
}

this what I'm getting back.. when I output it..

"sampletime" =\> 2018-08-14T15:14:44.000Z,  
"@timestamp" =\> 2018-08-14T15:18:02.392Z

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 14, 2018, 5:09pm UTC](https://discuss.elastic.co/t/date-filter-iso-8601/144365/2 "2018-08-14T17:09:39Z")

</div>

If that is the output of stdout { codec =\> rubydebug } then given that sampletime is not surrounded by quotes, it is already a date. And date [cannot parse a date](https://github.com/logstash-plugins/logstash-filter-date/issues/95). Use mutate+convert to make sampletime a string and then the ISO8601 shorthand should work.

---

<div class="post-metadata">

**Author:** ![Ken\_Leoni](https://avatars.discourse-cdn.com/v4/letter/k/ea666f/32.png) [@Ken\_Leoni](https://discuss.elastic.co/u/Ken_Leoni)\
**Post date:** [August 14, 2018, 5:47pm UTC](https://discuss.elastic.co/t/date-filter-iso-8601/144365/3 "2018-08-14T17:47:38Z")

</div>

OK.. that's the ticket

---

<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:** [September 11, 2018, 5:47pm UTC](https://discuss.elastic.co/t/date-filter-iso-8601/144365/4 "2018-09-11T17:47:44Z")

</div>

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