[Time Zone] How to get the Current Time of a TimeZone?

Forge Component
(13)
Published on 2018-10-01 by André Vieira
13 votes
Published on 2018-10-01 by André Vieira

i have list of all the timezone  . So how do i get the current time of the user base on their respective timezone.

Hi Vikas C,

    You cannot directly achieve this. If it is a mobile means to get Geo locations then you fetch their timezone, or else u give an option in profile to users manually set their timezone after only you get thier current timezone. Because the local system and server timezones are different. when you go to online you'll receive the server's timezone, not getting a local system or device's timezone.

Vikas C wrote:

i have list of all the timezone  . So how do i get the current time of the user base on their respective timezone.

You can use 

ConvertToUTC(CurrDateTime(), GetCurrentTimeZone().TimeZone.Identifier)

As a function (or as a action) in a expression to get the current time in UTC

Now that you have the UTC Time, you can convert to anywhere else using either the AddHours() function with a + or - value, or use the ConvertFromUTC() Function, in a similar way as the example before. 

For this last one you will have to know de Identifier that the plugin uses for the desired time zone.


Hope this helps!!