# Date format representation for "2020-01-29T21:40:00.000+0000" to assign to @timestamp

**URL:** <https://discuss.elastic.co/t/date-format-representation-for-2020-01-29t2100-000-0000-to-assign-to-timestamp/217261>\
**Category:** Logstash\
**Created:** [January 30, 2020, 6:57pm UTC](https://discuss.elastic.co/t/date-format-representation-for-2020-01-29t2100-000-0000-to-assign-to-timestamp/217261 "2020-01-30T18:57:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xyz2](https://avatars.discourse-cdn.com/v4/letter/x/e480ec/32.png) [@xyz2](https://discuss.elastic.co/u/xyz2)\
**Post date:** [January 30, 2020, 6:57pm UTC](https://discuss.elastic.co/t/date-format-representation-for-2020-01-29t2100-000-0000-to-assign-to-timestamp/217261/1 "2020-01-30T18:57:05Z")

</div>

HI,

I need to assign the string in format "2020-01-29T21:40:00.000+0000" to @timestamp.  
Used date filter . How is the format represented exactly ?  
date {

```
  match => ["[sampleDate]", "ISO8601"]
  #match => ["[sampleDate]", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ]

}
```

---

<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:** [January 30, 2020, 7:45pm UTC](https://discuss.elastic.co/t/date-format-representation-for-2020-01-29t2100-000-0000-to-assign-to-timestamp/217261/2 "2020-01-30T19:45:15Z")

</div>

If [sampleDate] contains "2020-01-29T21:40:00.000+0000" then that date filter will produce

```
"@timestamp" => 2020-01-29T21:40:00.000Z,
```

---

<div class="post-metadata">

**Author:** ![xyz2](https://avatars.discourse-cdn.com/v4/letter/x/e480ec/32.png) [@xyz2](https://discuss.elastic.co/u/xyz2)\
**Post date:** [January 30, 2020, 8:15pm UTC](https://discuss.elastic.co/t/date-format-representation-for-2020-01-29t2100-000-0000-to-assign-to-timestamp/217261/3 "2020-01-30T20:15:02Z")

</div>

In the next step i try to do the following to assign valid timestamp to sampleDate

date {  
match =\> ["[sampleDate]", "ISO8601"]  
target =\> "sampleDate"  
}

and have the type for sampleDate as "date" in mapping template. However it errors out.  
ERROR below:

"mapper\_parsing\_exception", "reason"=\>"failed to parse field [sampleDate] of type [long] in document with id '9460474694a76b4d1823bf06805f9d47cc2701509279045fb07acbcab31c154eaead59d98825a39ae409aa2cc75b7a1f52802a8c394afc83c68749354a0539d1'. Preview of field's value: '2020-01-30T19:31:40.000Z'", "caused\_by"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"For input string: "2020-01-30T19:31:40.000Z""}}}}}

NOTE: I also tried mutate copy @timestamp(after mapping) to sampleDate but that errors out too while indexing the data to ES

---

<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:** [February 27, 2020, 8:15pm UTC](https://discuss.elastic.co/t/date-format-representation-for-2020-01-29t2100-000-0000-to-assign-to-timestamp/217261/4 "2020-02-27T20:15:03Z")

</div>

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