# ESQL for Current Month

**URL:** https://discuss.elastic.co/t/esql-for-current-month/309915
**Category:** Kibana
**Tags:** canvas
**Created:** [July 18, 2022, 2:25pm UTC](https://discuss.elastic.co/t/esql-for-current-month/309915 "2022-07-18T14:25:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![karnamonkster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karnamonkster/32/67266_2.png) [@karnamonkster](https://discuss.elastic.co/u/karnamonkster)
#### Post date: [July 18, 2022, 2:25pm UTC](https://discuss.elastic.co/t/esql-for-current-month/309915/1 "2022-07-18T14:25:05Z")

</div>

Hi,  
I need to get data on the Canvas for current month only.  
Can someone help with the SQL query on Canvas similar to the KQL below.

`@timestamp > "now/M" and @timestamp <= "now"`

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [July 19, 2022, 7:23am UTC](https://discuss.elastic.co/t/esql-for-current-month/309915/2 "2022-07-19T07:23:39Z")

</div>

This should work:

```auto
WHERE timestamp > DATE_TRUNC('month', NOW()) and timestamp <= NOW()

```

> **[Date/Time and Interval Functions and Operators | Elasticsearch Guide \[8.3\] |...](https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-functions-datetime.html#sql-functions-datetime-trunc)**

---

<div class="post-metadata">

### Author: ![karnamonkster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karnamonkster/32/67266_2.png) [@karnamonkster](https://discuss.elastic.co/u/karnamonkster)
#### Post date: [July 19, 2022, 9:33am UTC](https://discuss.elastic.co/t/esql-for-current-month/309915/3 "2022-07-19T09:33:58Z")

</div>

> [@flash1293](#):
>
> `WHERE timestamp > DATE_TRUNC('month', NOW()) and timestamp <= NOW()`

Thanks a ton 😉 😃

---

<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: [August 16, 2022, 9:34am UTC](https://discuss.elastic.co/t/esql-for-current-month/309915/4 "2022-08-16T09:34:18Z")

</div>

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