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")

 

@timl , Thank you

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,494)