# Re-Index to new date format. getting parse\_exception

**URL:** <https://discuss.elastic.co/t/re-index-to-new-date-format-getting-parse-exception/251390>\
**Category:** Elasticsearch\
**Created:** [October 8, 2020, 7:51am UTC](https://discuss.elastic.co/t/re-index-to-new-date-format-getting-parse-exception/251390 "2020-10-08T07:51:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmadsayeed3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmadsayeed3/32/72888_2.png) [@ahmadsayeed3](https://discuss.elastic.co/u/ahmadsayeed3)\
**Post date:** [October 8, 2020, 7:51am UTC](https://discuss.elastic.co/t/re-index-to-new-date-format-getting-parse-exception/251390/1 "2020-10-08T07:51:09Z")

</div>

```auto
   POST _reindex
    {
      "source": {
        "index": "source"
      },
      "dest": {
        "index": "dest"
      },
      "script": {
        "source": """
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
        ctx._source.execution_end_time = format.format(format.parse(ctx._source.execution_end_time));
        """
      }
    }

```

getting this error. Please guide on this.

```auto
    {
      "error": {
        "root_cause": [
          {
            "type": "script_exception",
            "reason": "runtime error",
            "script_stack": [
              "java.base/java.text.DateFormat.parse(DateFormat.java:395)",
              "ctx._source.execution_end_time = format.format(format.parse(ctx._source.execution_end_time));",
              " ^---- HERE"
            ],
            "script": " SimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\");\n ctx._source.execution_end_time = format.format(format.parse(ctx._source.execution_end_time));",
            "lang": "painless"
          }
        ],
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "java.base/java.text.DateFormat.parse(DateFormat.java:395)",
          "ctx._source.execution_end_time = format.format(format.parse(ctx._source.execution_end_time));",
          " ^---- HERE"
        ],
        "script": " SimpleDateFormat format = new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\");\n ctx._source.execution_end_time = format.format(format.parse(ctx._source.execution_end_time));",
        "lang": "painless",
        "caused_by": {
          "type": "parse_exception",
          "reason": "Unparseable date: \"2020:09:17 06:46:26.679\""
        }
      },
      "status": 400
    }

```

---

<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 5, 2020, 7:51am UTC](https://discuss.elastic.co/t/re-index-to-new-date-format-getting-parse-exception/251390/2 "2020-11-05T07:51:15Z")

</div>

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