# Send date time to elasticsearch from php

**URL:** <https://discuss.elastic.co/t/send-date-time-to-elasticsearch-from-php/132613>\
**Category:** Elasticsearch\
**Created:** [May 21, 2018, 5:28am UTC](https://discuss.elastic.co/t/send-date-time-to-elasticsearch-from-php/132613 "2018-05-21T05:28:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nabha](https://avatars.discourse-cdn.com/v4/letter/n/bbce88/32.png) [@nabha](https://discuss.elastic.co/u/nabha)\
**Post date:** [May 21, 2018, 5:28am UTC](https://discuss.elastic.co/t/send-date-time-to-elasticsearch-from-php/132613/1 "2018-05-21T05:28:35Z")

</div>

I am sending json data from php to elasticsearch. My Json object has a field named as date which contains date time.  
[{"date":"2018-05-15 00:00:01", "reading" : 0},  
{"date":"2018-05-15 02:00:00", "reading" : 50},  
{"date":"2018-05-15 04:00:00", "reading" : 110},  
{"date":"2018-05-15 06:00:00", "reading" : 176},  
{"date":"2018-05-15 08:00:00", "reading" : 200}]

The data is getting added successfully to elasticsearch, but "date" goes in string format and not in datetime format. I also converted the date in date time format using php function, still not working.  
Please help.

---

<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:** [June 18, 2018, 5:28am UTC](https://discuss.elastic.co/t/send-date-time-to-elasticsearch-from-php/132613/2 "2018-06-18T05:28:35Z")

</div>

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