# Filter by date field in Kibana

**URL:** https://discuss.elastic.co/t/filter-by-date-field-in-kibana/149252
**Category:** Kibana
**Created:** [September 20, 2018, 8:58am UTC](https://discuss.elastic.co/t/filter-by-date-field-in-kibana/149252 "2018-09-20T08:58:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![espogian](https://avatars.discourse-cdn.com/v4/letter/e/4491bb/32.png) [@espogian](https://discuss.elastic.co/u/espogian)
#### Post date: [September 20, 2018, 8:58am UTC](https://discuss.elastic.co/t/filter-by-date-field-in-kibana/149252/1 "2018-09-20T08:58:53Z")

</div>

Hi,

I have a field correctly mapped as a datetime.  
For example, a possible value could be `August 21st 2018, 20:00:00.000`

Now I would like to filter documents in Kibana by selecting a particular date/time or an interval using the "add a filter" feature. However, I'm having throuble understanding which are the accepted formats.  
I found the documentation here being unclear: [https://www.elastic.co/guide/en/elasticsearch/reference/6.3/common-options.html#date-math](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/common-options.html#date-math)

For example, I can input "now" as a filter, but the date formatted as "2018-08-21 20:00:00" or "2018.08.21 20:00:00" does not work.  
I also tried using Unix timestamp (e.g. "1534874400") but I don't think the number is interpreted by Kibana as I would expect.

Could someone provide some examples?

Edit: "2018-08-21T18:00:00.000Z" seems to be working

---

<div class="post-metadata">

### Author: ![elastock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elastock/32/35672_2.png) [@elastock](https://discuss.elastic.co/u/elastock)
#### Post date: [September 20, 2018, 9:12am UTC](https://discuss.elastic.co/t/filter-by-date-field-in-kibana/149252/2 "2018-09-20T09:12:26Z")

</div>

Query edit filter =\>

> ```
> {
> "range": {
> "@timestamp": {
> "gte": "2018-06-05T20:00:00Z",
> "lt": "now",
> "format": "strict_date_optional_time"
> }
> }
> }
> 
> ```

---

<div class="post-metadata">

### Author: ![espogian](https://avatars.discourse-cdn.com/v4/letter/e/4491bb/32.png) [@espogian](https://discuss.elastic.co/u/espogian)
#### Post date: [September 20, 2018, 1:04pm UTC](https://discuss.elastic.co/t/filter-by-date-field-in-kibana/149252/3 "2018-09-20T13:04:23Z")

</div>

What if I want to filter only by time? E.g. all dates but only 20:00:00Z? Is it possible?

---

<div class="post-metadata">

### Author: ![elastock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elastock/32/35672_2.png) [@elastock](https://discuss.elastic.co/u/elastock)
#### Post date: [September 20, 2018, 2:10pm UTC](https://discuss.elastic.co/t/filter-by-date-field-in-kibana/149252/4 "2018-09-20T14:10:59Z")

</div>

I've already asked myself the question. But i did not investigated much more .

You can do it for 2018-06-05/Month

i'm not sure that you can do the same for hour/min/s

[DOC date math](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/common-options.html#date-math)

But you can do whatever you want like parsing the date with script query :  
[script query](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/query-dsl-script-query.html)

---

<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: [October 18, 2018, 2:11pm UTC](https://discuss.elastic.co/t/filter-by-date-field-in-kibana/149252/5 "2018-10-18T14:11:02Z")

</div>

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