# It is summer time again

**URL:** <https://community.dynatrace.com/t/it-is-summer-time-again/51022>\
**Category:** Automations\
**Tags:** workflows, automations\
**Created:** [April 2, 2025, 6:18pm UTC](https://community.dynatrace.com/t/it-is-summer-time-again/51022 "2025-04-02T18:18:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [April 2, 2025, 6:18pm UTC](https://community.dynatrace.com/t/it-is-summer-time-again/51022/1 "2025-04-02T18:18:02Z")

</div>

Hello,

I really wat to use the local time in my workflow, new Date() always returns UTC.

Who knows how to do this?

KR Henk

---

<div class="post-metadata">

**Author:** ![yanezza](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yanezza/32/5036_2.png) [@yanezza](https://community.dynatrace.com/u/yanezza)\
**Post date:** [April 5, 2025, 6:27pm UTC](https://community.dynatrace.com/t/it-is-summer-time-again/51022/2 "2025-04-05T18:27:12Z")

</div>

Hi,  
Are you talking about the JS code in workflow? The _“new Date()”_ seems to be javascript sintax

Anyway, after getting the date in UTC, convert it in your timezone when you are getting the string.

```markup
let localDate = new Date();

let dateOptions = { timeZone: 'Europe/Rome' };
let localDateString = localDate.toLocaleDateString('en-US', dateOptions);
let localTimeString = localDate.toLocaleTimeString('en-US', dateOptions);

console.log(`Date: ${localDateString}`);
console.log(`Time: ${localTimeString}`);

```

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [April 6, 2025, 9:21am UTC](https://community.dynatrace.com/t/it-is-summer-time-again/51022/3 "2025-04-06T09:21:05Z")

</div>

Cool, thanks. Yep I am using this in a WF:blush:

---

<div class="post-metadata">

**Author:** ![ChristopherHejl](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/christopherhejl/32/20735_2.png) [@ChristopherHejl](https://community.dynatrace.com/u/ChristopherHejl)\
**Post date:** [April 7, 2025, 7:48am UTC](https://community.dynatrace.com/t/it-is-summer-time-again/51022/4 "2025-04-07T07:48:38Z")

</div>

You can also use the now() expression [Expression reference — Dynatrace Docs](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/reference#now)  
This supports timezones, returns a datetime object, which you can use to do timecalculation in your expression as well like so [Jinja expressions for Workflows — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/automation-workflow-expression-reference#timedelta) and you can serialize it into any kind of date/time format you like, eg:

```python
{{ now('Europe/Vienna').strftime("%b %d %Y") }}

```

 ![ChristopherHejl_0-1744012103748.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/b/7ba811b114a9cdadf1e08ec9aa0f285ca5089759.png)

 ![ChristopherHejl_1-1744012111737.png](https://global.discourse-cdn.com/dynatrace/original/3X/9/1/91b5a01b26d4c9897e6dece6f29edb31e363d093.png)

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [April 9, 2025, 6:42pm UTC](https://community.dynatrace.com/t/it-is-summer-time-again/51022/5 "2025-04-09T18:42:37Z")

</div>

Both,

Thanks for your reply’s.

I did selected (before reading your great suggestions):

const myDate = new Date();  
let localDateString = myDate.toLocaleString(“en-US”, { timeZone: “Europe/Amsterdam” });

After this I converted back to an object:

let localDate = new Date(localDateString);

so later in the script I can use the well known methods like localDate.getHours();

Again thanks for your help!

KR Henk
