# Filter dynamic time range

**URL:** <https://community.dynatrace.com/t/filter-dynamic-time-range/40005>\
**Category:** DQL\
**Tags:** dql\
**Created:** [May 31, 2023, 2:04pm UTC](https://community.dynatrace.com/t/filter-dynamic-time-range/40005 "2023-05-31T14:04:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefan\_eggersto](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/stefan_eggersto/32/34114_2.png) [@stefan\_eggersto](https://community.dynatrace.com/u/stefan_eggersto)\
**Post date:** [May 31, 2023, 2:04pm UTC](https://community.dynatrace.com/t/filter-dynamic-time-range/40005/1 "2023-05-31T14:04:01Z")

</div>

Is it possible to filter the time with a time range only, e.g. from 5:30am yesterday to 5:30am today?

---

<div class="post-metadata">

**Author:** ![sinisa\_zubic](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sinisa_zubic/32/32498_2.png) [@sinisa\_zubic](https://community.dynatrace.com/u/sinisa_zubic)\
**Post date:** [May 31, 2023, 2:36pm UTC](https://community.dynatrace.com/t/filter-dynamic-time-range/40005/2 "2023-05-31T14:36:12Z")

</div>

Hi Stefan,  
this should be the query

```c-mrkdwn__pre
fetch logs, from: bin(now()-1d, 1d) + 17h + 30m, to: bin(now(), 1d) + 17h + 30m

```

basically, you make use of the from an to parameters.

- with now()-1d, you specify the timeframe exactly 24h ago
- then with&nbsp;bin(now()-1d, 1d) you round it to the start at the day, so at midnight
- then you add the time of the day with&nbsp;+ 17h + 30m

Best,Sini

---

<div class="post-metadata">

**Author:** ![Maheedhar\_T](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/maheedhar_t/32/155_2.png) [@Maheedhar\_T](https://community.dynatrace.com/u/Maheedhar_T)\
**Post date:** [June 3, 2024, 5:45am UTC](https://community.dynatrace.com/t/filter-dynamic-time-range/40005/3 "2024-06-03T05:45:20Z")

</div>

Also,  
If your timezone is not in UTC then you might have to subtract/add that from the timeframe as Sini mentioned above.  
My timezone is UTC+5:30 so I had to

```auto
from: bin(now()-1d, 1d) -5h -30m, to: bin(now(), 1d) -5h - 30m

```

do this to get the data of previous day.

Thanks&nbsp;[@sinisa\_zubic](https://community.dynatrace.com/user/38283)&nbsp;this saved lot of effort for me&nbsp;:smiley:.

Regards,

Maheedhar.
