# Date diff elasticsearch wrong?

**URL:** https://discuss.elastic.co/t/date-diff-elasticsearch-wrong/315745
**Category:** Elasticsearch
**Created:** [October 4, 2022, 7:18am UTC](https://discuss.elastic.co/t/date-diff-elasticsearch-wrong/315745 "2022-10-04T07:18:36Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![robocon20x](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robocon20x/32/99145_2.png) [@robocon20x](https://discuss.elastic.co/u/robocon20x)
#### Post date: [October 4, 2022, 7:18am UTC](https://discuss.elastic.co/t/date-diff-elasticsearch-wrong/315745/1 "2022-10-04T07:18:36Z")

</div>

Hi everyone, i found a different between datediff function on my ES and phoenix,trino.  
when use SQL below my ES return 4 while phoenix and trino return 5. How this different could happened?

```auto

POST _sql?format=json
{
  "query":"""SELECT date_diff('d', '2022-09-29T12:10:00.000Z'::datetime, now()) AS "diffInDays" """,

  "time_zone":"Asia/Ho_Chi_Minh"
}

```

thanks so much

---

<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 1, 2022, 7:19am UTC](https://discuss.elastic.co/t/date-diff-elasticsearch-wrong/315745/2 "2022-11-01T07:19:10Z")

</div>

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