# How to use IN timeRangeWithModifier with time zone in QuestDB

**URL:** https://community.questdb.com/t/how-to-use-in-timerangewithmodifier-with-time-zone-in-questdb/46
**Category:** Community
**Tags:** sql, question
**Created:** [June 26, 2024, 6:24pm UTC](https://community.questdb.com/t/how-to-use-in-timerangewithmodifier-with-time-zone-in-questdb/46 "2024-06-26T18:24:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex004/uploads/questdb/original/1X/b6b1b349e598d0550947e63d7923a9d7df0279eb.png) [@system](https://community.questdb.com/u/system)
#### Post date: [June 26, 2024, 6:24pm UTC](https://community.questdb.com/t/how-to-use-in-timerangewithmodifier-with-time-zone-in-questdb/46/1 "2024-06-26T18:24:22Z")

</div>

How does IN timeRangeWithModifier handle a timezone which changes around UTC ? Say I wanted records at 4pm London every day for a year, it would need to give me 3pm UTC for part of the year and 4pm UTC for the other part. Is that possible?

---

<div class="post-metadata">

### Author: ![nwoolmer](https://yyz2.discourse-cdn.com/flex004/user_avatar/community.questdb.com/nwoolmer/32/24_2.png) [@nwoolmer](https://community.questdb.com/u/nwoolmer)
#### Post date: [June 26, 2024, 6:24pm UTC](https://community.questdb.com/t/how-to-use-in-timerangewithmodifier-with-time-zone-in-questdb/46/2 "2024-06-26T18:24:36Z")

</div>

Assuming simple table such as:

```auto
create table tst ( ts timestamp) timestamp(ts);

insert into tst 
select dateadd('h', x::int, '2024-01-01T00:00:00' )
from long_sequence(365*24);

```

we’d normally formulate the condition as:

```auto
select * from tst where ts in '2024-01-01T15:00:00;1h;1d;365';

```

Of course it doesn’t work because IN operator `timeRangeWithModifier` assumes UTC. If we rewrite it as:

```auto
select *
from tst 
where hour(to_timezone(ts, 'Europe/London') ) = 16

```

then it does produce the correct result but is slower as it doesn’t use [interval scan](https://questdb.io/docs/concept/interval-scan/) anymore (as can be checked with [EXPLAIN command](https://questdb.io/docs/reference/sql/explain/)). I think the most reasonable approach for now is to combine broader IN condition with hour() check, e.g.

```auto
select ts, hour(ts), to_timezone(ts, 'Europe/London'), hour(to_timezone(ts, 'Europe/London') )
from tst 
where ts in '2024-01-01T15:00:00;2h;1d;365'
and hour(to_timezone(ts, 'Europe/London') ) = 16

```

As we can see in the output, it produces the correct result around time of DST switch:

```auto
ts hour to_timezone hour1
2024-03-30T16:00:00.000000Z 16 2024-03-30T16:00:00.000000Z 16
2024-03-31T15:00:00.000000Z 15 2024-03-31T16:00:00.000000Z 16

```
