# Issue with Date with Python importing data into Elastic

**URL:** <https://discuss.elastic.co/t/issue-with-date-with-python-importing-data-into-elastic/269918>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [April 12, 2021, 5:07pm UTC](https://discuss.elastic.co/t/issue-with-date-with-python-importing-data-into-elastic/269918 "2021-04-12T17:07:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fallenour](https://avatars.discourse-cdn.com/v4/letter/f/c37758/32.png) [@fallenour](https://discuss.elastic.co/u/fallenour)\
**Post date:** [April 12, 2021, 5:07pm UTC](https://discuss.elastic.co/t/issue-with-date-with-python-importing-data-into-elastic/269918/1 "2021-04-12T17:07:37Z")

</div>

Hey I have a quick issue regarding using python to connect to elastic. When I go to import data as a date field, its giving me a time error due to time format, but Ive tried everything, including datestamp instead of just date, making sure it matches verbatim with the input data, and Ive completely exhausted all efforts. The current code snippet:

```auto
"<REDACTED>": {"type": "date", "format": "date_optional_time||strict_date_optional_time||yyyy-MM-dd'T'HH:mm:ss||yyyy-MM-dd HH:mm:ss||yyyy-MM-dd HH:mm:ss aa||yyyy-MM-dd HH:mm:ss||M/dd/yyyy HH:mm:ss aa||MM/dd/yyyy HH:mm:ss||MM/dd/yyyy HH:mm:ss aa||yyyy-MM-dd||epoch_millis"}

```

Error reports: Preview of Field's value: '2021-03-27 22:46:08'

That corresponds with the 4th date time format, but it fails to adopt it, even alone as a singular format.

Data file the data is importing from is .csv format if that helps any.

---

<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:** [May 10, 2021, 5:08pm UTC](https://discuss.elastic.co/t/issue-with-date-with-python-importing-data-into-elastic/269918/2 "2021-05-10T17:08:33Z")

</div>

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