# Change type character varying to date elasticsearch

**URL:** <https://discuss.elastic.co/t/change-type-character-varying-to-date-elasticsearch/311885>\
**Category:** Elasticsearch\
**Created:** [August 10, 2022, 10:45pm UTC](https://discuss.elastic.co/t/change-type-character-varying-to-date-elasticsearch/311885 "2022-08-10T22:45:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![5k\_pwc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/5k_pwc/32/107057_2.png) [@5k\_pwc](https://discuss.elastic.co/u/5k_pwc)\
**Post date:** [August 10, 2022, 10:45pm UTC](https://discuss.elastic.co/t/change-type-character-varying-to-date-elasticsearch/311885/1 "2022-08-10T22:45:44Z")

</div>

hi ,  
anyone know how to changed data from char to date,  
i have inserted this code but she doesnt work .  
"datecons" : {  
"type" : "date"  
"format": "yyyy-MM-dd HH:mm:ss.SSSSSS"  
},

and my data like this:  
 ![Capture d’écran 2022-08-10 234004](https://us1.discourse-cdn.com/elastic/original/3X/a/d/adcf29a5f5637015f36364957740c88b3ba97c56.png)

---

<div class="post-metadata">

**Author:** ![hendry.lim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendry.lim/32/71328_2.png) [@hendry.lim](https://discuss.elastic.co/u/hendry.lim)\
**Post date:** [August 10, 2022, 10:52pm UTC](https://discuss.elastic.co/t/change-type-character-varying-to-date-elasticsearch/311885/2 "2022-08-10T22:52:11Z")

</div>

The date format you specified doesn't match with the data date format.

---

<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:** [September 7, 2022, 10:53pm UTC](https://discuss.elastic.co/t/change-type-character-varying-to-date-elasticsearch/311885/3 "2022-09-07T22:53:10Z")

</div>

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