24
Views
4
Comments
[Time Zone] Get Time Zone and DST based on country and state
Forge component by André Vieira
18
Published on 15 Oct 2020
Application Type
Traditional Web
Service Studio Version
11.10.3 (Build 36711)

Hi All,

I've been searching through the forum and webs still has no clue on how the TimeZone should be used.
I had a project to implement Time Zone and Daylight Saving(DST) in a condition where user selects company, it will show the Time Zone of the company and determine if the DST is required.

For example, Company ABC is locate in Australia, Sydney. When user selects Company ABC, it will shows the user that the Time Zone is Australia Eastern Standard Time, Daylight Saving = Yes. 

I maintain the company details (Company Id, Country and State) in DB. It is possible to get the Time Zone and DST if I maintain only these details?

Thank you.

Rank: #1066

Hello Gwen.

The TimeZone component had an action that translated the location into a timezone and it's details but it used a Google API Integration to do that. As I see here, the action seems to be deprecated and I wasn't able use it on the example website:  https://andrevieira.outsystemscloud.com/TimeZone/

I know that Google has an API for that, you can see if it fits your needs and if it's viable to integrate it in your project.

Here: https://developers.google.com/maps/documentation/timezone/overview

Rank: #17337

Hi Gwen, 

U can using the example website that Lucas mention, https://andrevieira.outsystemscloud.com/TimeZone/ 

and from your example if company ABC is located in Sydney,

in that sample u can try to choose Sydney timezone, and press go, you will see the identifier, 

then u can use this identifier at GetTimezone function to get the time zone details,

or you can use IANA identifier, in this case the IANA identifier is Australia/Sydney and then u can call GetIANATimeZone passing Australia/Sydney to get the Time zone details

there's a function to get all Time zone, GetSystemTimeZones this will return all the time zone, 

the pain is how to map the IANA or Identifier with your company location,

the search by location in the sample apps is using this action GetTimeZoneForLocation, but its not avail in Java, so if outsystems platform in java this wont be avail. 

Rank: #28667

Gwen,

    The way we are using this extension is to provide users the ability to select and store their time zone information in their profiles.  Then we have function that displays any datetimes in our application in the user's selected time zone.

Rank: #4618

Hi All, @Lucas Vilela, @ari auditianto, @Lennie Sutton,

Sorry for being late to get back.

Yes, I had tried to use the extension to check the time zone. I managed to find a way to solve my issue. My solution is that I stored the company detail (company name, country, time zone) in DB. When user select the specific company, it will display the time zone of that company. This might not be the good practice but it does help.

Thank you all for helping out, it may help me as a reference if I need to use API to get the location in future :)