# ESQL - diff with NOW()

**URL:** https://discuss.elastic.co/t/esql-diff-with-now/373321
**Category:** Elasticsearch
**Tags:** esql
**Created:** [January 17, 2025, 10:18am UTC](https://discuss.elastic.co/t/esql-diff-with-now/373321 "2025-01-17T10:18:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![mortenb123](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mortenb123/32/37227_2.png) [@mortenb123](https://discuss.elastic.co/u/mortenb123)
#### Post date: [January 17, 2025, 10:18am UTC](https://discuss.elastic.co/t/esql-diff-with-now/373321/1 "2025-01-17T10:18:14Z")

</div>

How can I create a nowdiff:

```auto
FROM *.events.* | limit 1 | EVAL mynow=now() | KEEP time,mynow

                    time mynow
2023-05-20T03:22:16.976Z 2025-01-17T10:07:54.328Z

```

But:

```auto
FROM *.events.* | limit 1 | EVAL mynow=now()-time | KEEP time,mynow

BadRequestError(400, 'verification_exception', 'Found 1 problem\nline 1:52: [-] has arguments with incompatible types [datetime] and [datetime]')

```

I would have had a clue if the type was different 🙂

I can subtract timediffs:

```auto
FROM *.events.* | limit 1 | EVAL mynow = NOW() - 1 day | KEEP time,mynow

                    time mynow
2023-04-30T03:23:04.498Z 2025-01-16T10:15:35.728Z

```

Thanks

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 17, 2025, 2:36pm UTC](https://discuss.elastic.co/t/esql-diff-with-now/373321/2 "2025-01-17T14:36:22Z")

</div>

You can use `DATE_DIFF`. See this example for another dataset:

```auto
FROM person
| LIMIT 1
| EVAL age = DATE_DIFF("year", dateOfBirth, NOW())

```
