# Timestamp dayOfWeek

**URL:** <https://discuss.elastic.co/t/timestamp-dayofweek/365605>\
**Category:** Kibana\
**Tags:** painless\
**Created:** [August 27, 2024, 9:45am UTC](https://discuss.elastic.co/t/timestamp-dayofweek/365605 "2024-08-27T09:45:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre\_CHERAMY](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_cheramy/32/137082_2.png) [@Alexandre\_CHERAMY](https://discuss.elastic.co/u/Alexandre_CHERAMY)\
**Post date:** [August 27, 2024, 9:45am UTC](https://discuss.elastic.co/t/timestamp-dayofweek/365605/1 "2024-08-27T09:45:35Z")

</div>

Hi, I'm trying to create a visualization in kibana by filtering on the timestamp field. I want to filter by day of the week.

For the moment, I obtain the sum for a given month, but I would like to remove specific days from this sum (for example, count every Mondays). I tried by making a scripted fields or directly by putting a DSL and/or KQL query, but without success.

Here is an example of the filter I am trying to do in DSL Query. However, the script returns me zero results:

```auto
{
  "query": {
    "bool": {
      "must": {
        "script": {
          "script": {
            "source": "doc['@timestamp'].value.dayOfWeek == 1",
            "lang": "painless"
          }
        }
      }
    }
  }
}

```

Do you have any ideas on how to make this type of filter?

Thx

---

<div class="post-metadata">

**Author:** ![ashishtiwari1993](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashishtiwari1993/32/135241_2.png) [@ashishtiwari1993](https://discuss.elastic.co/u/ashishtiwari1993)\
**Post date:** [August 27, 2024, 1:24pm UTC](https://discuss.elastic.co/t/timestamp-dayofweek/365605/2 "2024-08-27T13:24:10Z")

</div>

Hi @Alexandre_CHERAMY,

Below query worked for me:

```auto
{
  "query": {
    "script": {
      "script": {
        "source": "doc['@timestamp'].value.getDayOfWeek().getValue() == 1",
        "lang": "painless"
      }
    }
  }
}

```
