Device timezone

Hi,

Is there a way (or any component, internal or external) that can be used to get the timezone or the UTC offset of the device/user?

Cheers,
Fred.

Hi @Fred,

Try this script with the Abitrary JavaScript component :

var first = (new Date().toTimeString().slice(9));
var second = (Intl.DateTimeFormat().resolvedOptions().timeZone);
var third = (new Date().getTimezoneOffset() /-60);
var full = first + "," + '\xa0' + second + "," + '\xa0' + third
return full;





image

How to download the Abitrary JavaScript component : PragmaFlow's Adalo Marketplace Reopened - YouTube

Thank you

1 Like

Hi @Fred ,

An alternative way than @dilon_perera 's way.

Add 2 properties in users collection:

  • Date & Time
  • Date

have an action update logged in users with these properties with Start of Today,
Screen Shot 2022-06-24 at 7.32.30 AM

then use custom formula to get the timezone,
Screen Shot 2022-06-24 at 7.33.49 AM

The result would be,
Screen Shot 2022-06-24 at 7.34.36 AM

To eliminate fraction, use INT()

1 Like

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