# Text '24/07/2018 11:04' could not be parsed at index 0

**URL:** <https://discuss.elastic.co/t/text-24-07-2018-11-04-could-not-be-parsed-at-index-0/262597>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-sql\
**Created:** [January 29, 2021, 6:11am UTC](https://discuss.elastic.co/t/text-24-07-2018-11-04-could-not-be-parsed-at-index-0/262597 "2021-01-29T06:11:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yash\_watwani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yash_watwani/32/48138_2.png) [@yash\_watwani](https://discuss.elastic.co/u/yash_watwani)\
**Post date:** [January 29, 2021, 6:11am UTC](https://discuss.elastic.co/t/text-24-07-2018-11-04-could-not-be-parsed-at-index-0/262597/1 "2021-01-29T06:11:21Z")

</div>

My row kinda look like this

```auto
Opened_Date
25/07/2017 16:01
02/11/2017 13:49
06/11/2017 20:36
09/11/2017 18:46
13/11/2017 13:51
22/11/2017 08:26
22/11/2017 09:16
24/11/2017 09:31

```

I am trying to run this query

```auto
SELECT DATETIME_FORMAT(CAST(Opened_Date AS DATETIME), 'dd/MM/YYYY HH:mm') AS opened from eta

```

I am getting this error

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "ql_illegal_argument_exception",
        "reason" : "cannot cast [24/07/2018 11:04] to [datetime]: Text '24/07/2018 11:04' could not be parsed at index 0"
      }
    ],
    "type" : "ql_illegal_argument_exception",
    "reason" : "cannot cast [24/07/2018 11:04] to [datetime]: Text '24/07/2018 11:04' could not be parsed at index 0",
    "caused_by" : {
      "type" : "date_time_parse_exception",
      "reason" : "Text '24/07/2018 11:04' could not be parsed at index 0"
    }
  },
  "status" : 500
}

```

---

<div class="post-metadata">

**Author:** ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)\
**Post date:** [January 30, 2021, 5:31pm UTC](https://discuss.elastic.co/t/text-24-07-2018-11-04-could-not-be-parsed-at-index-0/262597/2 "2021-01-30T17:31:26Z")

</div>

This might work for you.

**Query**

```auto
POST /_sql
{
  "query": "SELECT DATETIME_PARSE(Opened_Date, 'dd/MM/yyyy HH:mm') AS date from eta"
}

```

**Returns**

```auto
{
  "columns" : [
    {
      "name" : "date",
      "type" : "datetime"
    }
  ],
  "rows" : [
    [
      "2017-07-25T16:01:00.000Z"
    ],
    [
      "2017-11-02T13:49:00.000Z"
    ],
    [
      "2017-11-06T20:36:00.000Z"
    ],
    [
      "2017-11-09T18:46:00.000Z"
    ],
    [
      "2017-11-13T13:51:00.000Z"
    ],
    [
      "2017-11-22T08:26:00.000Z"
    ],
    [
      "2017-11-22T09:16:00.000Z"
    ],
    [
      "2017-11-24T09:31:00.000Z"
    ]
  ]
}

```

---

<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, 2021, 5:31pm UTC](https://discuss.elastic.co/t/text-24-07-2018-11-04-could-not-be-parsed-at-index-0/262597/3 "2021-02-27T17:31:58Z")

</div>

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