# Transform timezone with DQL

**URL:** <https://community.dynatrace.com/t/transform-timezone-with-dql/55614>\
**Category:** DQL\
**Tags:** dql, cost-management, monitoring-consumption\
**Created:** [April 17, 2026, 9:30am UTC](https://community.dynatrace.com/t/transform-timezone-with-dql/55614 "2026-04-17T09:30:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elenaperez](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/elenaperez/32/38054_2.png) [@elenaperez](https://community.dynatrace.com/u/elenaperez)\
**Post date:** [April 17, 2026, 9:30am UTC](https://community.dynatrace.com/t/transform-timezone-with-dql/55614/1 "2026-04-17T09:30:25Z")

</div>

Hi team

We have noticed that the dt.system.events are ingested with a different time zone. Is it possible to transform the timezone with DQL here?

 ![elenaperez_0-1776418218460.png](https://global.discourse-cdn.com/dynatrace/original/2X/4/4058d5f6bf62cc1be68376dfe4f39c8734c9abcf.png)

I tried using bin(timestamp,24h,at:-1h), but with the change of hour, it gets desynchronized.  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [April 17, 2026, 10:49am UTC](https://community.dynatrace.com/t/transform-timezone-with-dql/55614/2 "2026-04-17T10:49:42Z")

</div>

Hi,  
Yes, it is possible in DQL, but not by using bin(timestamp, 24h, at: …).

bin(…, at: -1h) behaves like a fixed offset, so it does not adjust for daylight saving time. That’s why it becomes misaligned after the time change.

A better approach is to build the local day using timezone-aware functions, for example:

```markup
fetch dt.system.events
| filter event.kind == "BILLING_USAGE_EVENT" AND
    in(
      event.type,
      array(
        "Full-Stack Monitoring",
        "Infrastructure Monitoring",
        "Foundation & Discovery",
        "Mainframe Monitoring"
      )
    )
| dedup event.id
| fieldsAdd billed_units = coalesce(
    toDouble(billed_gibibyte_hours),
    toDouble(billed_host_hours),
    toDouble(billed_msu_hours)
  )
| fieldsAdd unit_price_eur =
    if(event.type == "Infrastructure Monitoring", toDouble(1),
    else: if(event.type == "Foundation & Discovery", toDouble(1),
    else: if(event.type == "Full-Stack Monitoring", toDouble(1),
    else: if(event.type == "Mainframe Monitoring", toDouble(1),
    else: null))))
| fieldsAdd estimated_cost_eur = billed_units * unit_price_eur
| fieldsAdd local_year = getYear(timestamp, timezone:"Europe/Madrid")
| fieldsAdd local_month = getMonth(timestamp, timezone:"Europe/Madrid")
| fieldsAdd local_daynum = getDayOfMonth(timestamp, timezone:"Europe/Madrid")
| fieldsAdd local_day = timestamp(
    year: local_year,
    month: local_month,
    day: local_daynum,
    hour: 0,
    minute: 0,
    second: 0,
    timezone: "Europe/Madrid"
  )
| summarize `Application and Infrastructure Observability` = sum(estimated_cost_eur),
    by: { event.type, local_day }
| sort local_day asc

```

Then you can aggregate by local\_day.  
For display purposes, you can also use:

```markup
formatTimestamp(timestamp, timezone:"Europe/Madrid")

```

 ![1.jpg](https://global.discourse-cdn.com/dynatrace/original/2X/d/db3d7b5140650e1f35e0b0a1dfef08afdb7fa040.jpeg)

---

<div class="post-metadata">

**Author:** ![krzysztof\_hoja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/krzysztof_hoja/32/34625_2.png) [@krzysztof\_hoja](https://community.dynatrace.com/u/krzysztof_hoja)\
**Post date:** [May 20, 2026, 8:00am UTC](https://community.dynatrace.com/t/transform-timezone-with-dql/55614/3 "2026-05-20T08:00:08Z")

</div>

The statement that “dt.system.events are ingested with a different time zone” is incorrect. Timestamp is Grail is stred in universal time, so timzonel-less and can pre presented in any timezone. The problem is caused by use of _**bin()**_.

The easies solution is to use _ **makeTimeseries** _ or time alignement operator&nbsp;_ **@** _ . Both them are user timezone aware. To example queries:

```markup
fetch dt.system.events
| makeTimeseries cnt = count(), by: {event.type}, interval:24h

```

and

```markup
fetch dt.system.events
| summarize cnt = count(), by: {event.type, timestamp = timestamp@d}

```

 ![krzysztof_hoja_0-1779263994636.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/f/ffc3cc7c67ffc7bf7c13bc4d13662e830c049007.png)
