# Facing MapperParsingException\[failed to parse \[date\]\]

**URL:** <https://discuss.elastic.co/t/facing-mapperparsingexception-failed-to-parse-date/154970>\
**Category:** Elasticsearch\
**Created:** [November 1, 2018, 7:11am UTC](https://discuss.elastic.co/t/facing-mapperparsingexception-failed-to-parse-date/154970 "2018-11-01T07:11:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnrabi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johnrabi/32/67223_2.png) [@johnrabi](https://discuss.elastic.co/u/johnrabi)\
**Post date:** [November 1, 2018, 7:11am UTC](https://discuss.elastic.co/t/facing-mapperparsingexception-failed-to-parse-date/154970/1 "2018-11-01T07:11:54Z")

</div>

Hi Team ,  
can anyone help me to resolve this issue ?

while converting milliseconds to date facing this exception while indexing time ,  
Date dates = new Date(1532390400000L);  
Date convertedDate = new SimpleDateFormat("yyyy-MM-dd").parse(fmt.format(dates));  
elasticUpdated.setDate(convertedDate);

```
SimpleDateFormat fmts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

		mapper.setDateFormat(fmts);
		String stringifiedJson = mapper.writeValueAsString(elasticUpdated);

		bulkRequests.add(esclient.prepareIndex("index", "type", elasticUpdated.getId())
				.setSource(stringifiedJson));

```

Exception  
essage [MapperParsingException[failed to parse 2018-11-01 07:11:54; nested: IllegalArgumentException[Invalid format: "2018-07-24 00:00:00" is malformed at " 00:00:00"];]

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [November 1, 2018, 9:01am UTC](https://discuss.elastic.co/t/facing-mapperparsingexception-failed-to-parse-date/154970/2 "2018-11-01T09:01:33Z")

</div>

> [@johnrabi](#):
>
> Date convertedDate = new SimpleDateFormat("yyyy-MM-dd").parse(fmt.format(dates));

What does "fmt" refer to?

---

<div class="post-metadata">

**Author:** ![johnrabi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johnrabi/32/67223_2.png) [@johnrabi](https://discuss.elastic.co/u/johnrabi)\
**Post date:** [November 1, 2018, 9:40am UTC](https://discuss.elastic.co/t/facing-mapperparsingexception-failed-to-parse-date/154970/3 "2018-11-01T09:40:17Z")

</div>

> [@cbuescher](#):
>
> Date convertedDate = new SimpleDateFormat("yyyy-MM-dd").parse(fmt.format(dates));

hi @cbuescher,

fmt refer to below one  
SimpleDateFormat fmts = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

---

<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:** [November 29, 2018, 9:40am UTC](https://discuss.elastic.co/t/facing-mapperparsingexception-failed-to-parse-date/154970/4 "2018-11-29T09:40:18Z")

</div>

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