# Timezone Offset of the dashboard user

**URL:** <https://discourse.nodered.org/t/timezone-offset-of-the-dashboard-user/63929>\
**Category:** General\
**Tags:** node-red-dashboard, database\
**Created:** [14 June 2022 16:01 UTC](https://discourse.nodered.org/t/timezone-offset-of-the-dashboard-user/63929 "2022-06-14T16:01:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DemalCal96](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@DemalCal96](https://discourse.nodered.org/u/DemalCal96)\
**Post date:** [14 June 2022 16:01 UTC](https://discourse.nodered.org/t/timezone-offset-of-the-dashboard-user/63929/1 "2022-06-14T16:01:24Z")

</div>

Hello to all. I am creating a dashboard where with two date pickers and two time pickers, information is extracted from a database by means of an HTTP request. The problem I am having is that the date pickers take into account the time zone. For example, currently my GMT is +5, so if it is already 19:00 and I select a date, January 5th, the timestamp will correspond to January 6th (+5 hours). On the other hand, with the time pickers, I have the opposite problem, where if I select any time, it will come out as entered and will not take into account the offset. My Node-Red is running on an AWS instance, and when I use commands to extract the offset it always gives me +0 or UTC. This dashboard must be able to be used anywhere in the world, so I can't count on the +5 data from my current country, so I need some way to know the offset or GMT of the person entering the dashboard.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [14 June 2022 16:36 UTC](https://discourse.nodered.org/t/timezone-offset-of-the-dashboard-user/63929/2 "2022-06-14T16:36:22Z")

</div>

You can use `new Date()` in the ui-template node to get the browser time. You can also use `getTimezoneOffset()` to get time zone.

example when you land on dashboard the template should return iso timestamp and offset in mins

```auto
[{"id":"1f94fb5c.5fe375","type":"ui_ui_control","z":"e67b04df66bd0437","name":"","events":"all","x":190,"y":660,"wires":[["12852117.09e36f"]]},{"id":"12852117.09e36f","type":"function","z":"e67b04df66bd0437","name":"","func":"msg.template = `<script>\nvar btime = new Date();\nthis.scope.send({btime: btime, offset: btime.getTimezoneOffset()});\n</script>`\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":230,"y":700,"wires":[["9e7f00ae.6ac08"]]},{"id":"9e7f00ae.6ac08","type":"ui_template","z":"e67b04df66bd0437","group":"2d4fe667.28f8ba","name":"","order":5,"width":0,"height":0,"format":"","storeOutMessages":true,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","className":"","x":490,"y":640,"wires":[["2ca4bfc8.35ce5"]]},{"id":"2ca4bfc8.35ce5","type":"debug","z":"e67b04df66bd0437","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":640,"y":620,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 June 2022 16:37 UTC](https://discourse.nodered.org/t/timezone-offset-of-the-dashboard-user/63929/3 "2022-06-28T16:37:07Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
