# Using date functions in where clause

**URL:** <https://forum.opensearch.org/t/using-date-functions-in-where-clause/6516>\
**Category:** SQL\
**Created:** [July 15, 2021, 3:46pm UTC](https://forum.opensearch.org/t/using-date-functions-in-where-clause/6516 "2021-07-15T15:46:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrmet59](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@mrmet59](https://forum.opensearch.org/u/mrmet59)\
**Post date:** [July 15, 2021, 3:46pm UTC](https://forum.opensearch.org/t/using-date-functions-in-where-clause/6516/1 "2021-07-15T15:46:30Z")

</div>

Hi all,

We are running AES 7.9.

I submitted this query: SELECT adddate(curdate(), INTERVAL 1 DAY) FROM some-index\* which is simpler than the query I need which is the use of dates and date functions in the where clause.

And received this error (note: adddate will work when applied to timestamp but not this embedded function call. I don’t see anything wrong any suggestions or recommendations)

: Bad Request, this query is not runnable.

{  
“error”: {  
“reason”: “Invalid SQL query”,  
“details”: “”,  
“type”: “NullPointerException”  
},  
“status”: 400  
}

---

<div class="post-metadata">

**Author:** ![kris](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/kris/32/2208_2.png) [@kris](https://forum.opensearch.org/u/kris)\
**Post date:** [February 7, 2023, 5:17pm UTC](https://forum.opensearch.org/t/using-date-functions-in-where-clause/6516/2 "2023-02-07T17:17:43Z")

</div>


