# Date parsing error : Invalid format

**URL:** <https://discuss.elastic.co/t/date-parsing-error-invalid-format/68183>\
**Category:** Logstash\
**Created:** [December 6, 2016, 3:05pm UTC](https://discuss.elastic.co/t/date-parsing-error-invalid-format/68183 "2016-12-06T15:05:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehdi-aouadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mehdi-aouadi/32/13644_2.png) [@mehdi-aouadi](https://discuss.elastic.co/u/mehdi-aouadi)\
**Post date:** [December 6, 2016, 3:05pm UTC](https://discuss.elastic.co/t/date-parsing-error-invalid-format/68183/1 "2016-12-06T15:05:43Z")

</div>

I am trying to parse a date field from a jdbc input :

`SELECT TO_CHAR(date_column, 'YYYY-MM-DD') || 'T' || TO_CHAR(date_column, 'HH24:MI:SS') || 'Z' as "my_date" FROM my_table`

When I try to parse it in the filter so it can be used as @timestamp :

```
    filter {
          date {
               match => ["my_date", "yyyy-MM-dd HH:mm:ss"]
               target => "@timestamp"
         }
    }

```

I get the following error :

`"Invalid format: \"2016-12-06 12:12:00\" is malformed at 12:12:00`

The corresponding field mapping in Elasticsearch is :

`"my_date_field" : { "type" : "date", "format" : "date_time_no_millis" }`

Is the error due to the format I chose ?

---

<div class="post-metadata">

**Author:** ![mehdi-aouadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mehdi-aouadi/32/13644_2.png) [@mehdi-aouadi](https://discuss.elastic.co/u/mehdi-aouadi)\
**Post date:** [December 12, 2016, 10:32am UTC](https://discuss.elastic.co/t/date-parsing-error-invalid-format/68183/2 "2016-12-12T10:32:50Z")

</div>

Finally I updated the filter using the `ISO8601` Date Format and it works :

```
filter {
  date {
    match => ["my_date", "ISO8601"]
    target => "@timestamp"
  }
}
```

---

<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 9, 2017, 10:33am UTC](https://discuss.elastic.co/t/date-parsing-error-invalid-format/68183/3 "2017-01-09T10:33:04Z")

</div>

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