cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JR-BejeweledOne
Super User
Super User

Time and TimeZone

Time and TimeZone challenge.   I know how to use the TimeZoneOffset, but am not sure if or how to use it to accomplish what I need to accomplish.

 

Here is the challenge. 

 

Users - anywhere in the world

 

Challenge:  Regardless of where the user of the app is located, I need to be able to determine if the time in CDT Timezone (UTC -06:00 or -05:00 during DST) is >= 11am and if so change the information that is being displayed.   

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@JR-BejeweledOne 

You will need to determine the timezone for CT first.  Your real challenge will be with the DST aspect.  You will not be able to rely on that as it will give you different results based on different regions.  Even parts of the US don't use DST, so those would always return a standard time.

Ideally you would want to convert all times CT and anywhere in the world, to standard time first.  That will be the base line.  To really put the logic in to do that, you need to put in the DST start and end dates.  BUT, this still represents a problem with regions that don't use DST...as you'll not be able to get that region information.

 

SO, how to really combat this issue is going to be to think outside the box (or outside the app in this case).  You can consider employing a web service that will return current time for a specified region.  I can't name any off hand, but there are such services out there that can provide an API to do this.

The other option is to (since you want everything based off of the CT current hour), employ a flow that will run every hour and will update a list with the current CT hour.  Then your app, anywhere in the world, can grab that from the list and use it in the comparison.

 

It's painful indeed as there is no real way to get specific region information in the app, so you kind of have to augment it.  I know I've dealt with this with US-wide app (especially dealing with the regions that never observe DST) and the solution there was capturing the local date and time in the app and storing it as static text (not a date type column).  Then, for comparison, the app grabs from the list that has the "central home" date and time.

 

Hopefully this gives you some ideas to consider.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@JR-BejeweledOne 

You will need to determine the timezone for CT first.  Your real challenge will be with the DST aspect.  You will not be able to rely on that as it will give you different results based on different regions.  Even parts of the US don't use DST, so those would always return a standard time.

Ideally you would want to convert all times CT and anywhere in the world, to standard time first.  That will be the base line.  To really put the logic in to do that, you need to put in the DST start and end dates.  BUT, this still represents a problem with regions that don't use DST...as you'll not be able to get that region information.

 

SO, how to really combat this issue is going to be to think outside the box (or outside the app in this case).  You can consider employing a web service that will return current time for a specified region.  I can't name any off hand, but there are such services out there that can provide an API to do this.

The other option is to (since you want everything based off of the CT current hour), employ a flow that will run every hour and will update a list with the current CT hour.  Then your app, anywhere in the world, can grab that from the list and use it in the comparison.

 

It's painful indeed as there is no real way to get specific region information in the app, so you kind of have to augment it.  I know I've dealt with this with US-wide app (especially dealing with the regions that never observe DST) and the solution there was capturing the local date and time in the app and storing it as static text (not a date type column).  Then, for comparison, the app grabs from the list that has the "central home" date and time.

 

Hopefully this gives you some ideas to consider.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Too bad MS doesn't incorporate the TZ database so it can be used in these sorts of calculations.

 

https://en.wikipedia.org/wiki/Tz_database



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
RandyHayes
Super User
Super User

@JR-BejeweledOne 

Yes, wishful thinking!! 😉  I would settle with even some basics like getting back the current location and possibly even something that indicates if it is standard or daylight savings.  Especially since you need this type of info for a lot of the calendaring actions on connectors.  

Oh well...workarounds it is for now.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I did come up with a possibility.   In working with something totally unrelated to Power Apps, I discovered that our SharePoint online tenant time is Pacific Time.   I could conceivably create an event calendar, and put a single repeating entry on it, (repeats every week at the time I want to switch), that I could use as the base for the time calculation.

 

I think I can figure something out using that.   I just haven't had time to look at it yet.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,991)