cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
techtudoor
Resolver I
Resolver I

compare date time to different time zones

I have an app that is used across multiple regions (US, UK, EU, etc...). I need to limit the use of certain parts of the app during specific set times. When I use the code below in the Visible property of the controls, it only allows for people in the US to enter due to the date format for different regions. 

Now()<DateTimeValue("4/20/2021, 12:01:00 AM") || Now() >= DateTimeValue("5/19/2021, 12:01:00 AM")

 

I was thinking that I need to adjust the code to:

 

Text(Now(), dd/mm/yyyy)<Text(DateTimeValue("4/20/2021, 12:01:00 AM"), dd/mm/yyyy hh:mm:ss) || Text(Now(), dd/mm/yyyy) >= Text(DateTimeValue("5/19/2021, 12:01:00 AM"), dd/mm/yyyy hh:mm:ss)

 

But receive an error that it expected text. Where am I going wrong? I just need to have it available during these dates and times for users in all regions, regardless of their date/time format.

 

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

@techtudoor 

If you specify the locale in your call to DateTimeValue, that will ensure that the function parses your input date/time in the correct format.

Now()<DateTimeValue("4/20/2021, 12:01:00 AM", "en-US") || Now() >= DateTimeValue("5/19/2021, 12:01:00 AM", "en-US")

 

View solution in original post

2 REPLIES 2
timl
Super User
Super User

@techtudoor 

If you specify the locale in your call to DateTimeValue, that will ensure that the function parses your input date/time in the correct format.

Now()<DateTimeValue("4/20/2021, 12:01:00 AM", "en-US") || Now() >= DateTimeValue("5/19/2021, 12:01:00 AM", "en-US")

 

View solution in original post

@timl , Thank you

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,665)