web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Trying to limit access...
Power Apps
Answered

Trying to limit access to button by date - formula isn't working as intended

(0) ShareShare
ReportReport
Posted on by 63

 

If(Text(Today(), "[$-en-US]ddd", "en-GB") = "Monday" Or "Thursday" 
And Text(CCDatePicker.SelectedDate,"[$-en-US]mm/dd/yyyy") = Text(DateAdd(Today(),1),"[$-en-US]dd/mm/yyyy") 
And Value(Hour(Now())) > 10, 
View, Edit)

 

I am trying to do the following:

 

If today is either Monday or Thursday,

Check if date selected by user is equal to tomorrow 

and that if the time is past 10am.

 

Not working, not sure why. Can anyone shine some light on this for me?

Thanks in advance 🙂 

Categories:
  • Verified answer
    eka24 Profile Picture
    20,925 on at

    Use this formula:

    Weekday(Today())=2 Or Weekday(Today())=5 &&
    DatePicker2_1.SelectedDate=Today()+1&&Hour(Now())>10
    It based on the assumption that starting day of the week is sunday=1
     
    If you like this post, give a Thumbs up. Where it solved your request,
    Mark it as a Solution to enable other users find it.
     
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Alfie_Smith ,

    Based on the formula that you provided, I think there is something wrong with it.

     

    The Text(datetimevalue, "[$-en-US]ddd") formula would display the day as an abbreviation (Sun to Sat) rather than (Sunday to Saturday). On your side, you should change it as below:

    Text(datetimevalue, "[$-en-US] dddd", "en-GB")

    Date and time placeholders in Text function

     

    In addition, when comparing if selected date value is equal to tomorrow, please make sure the custom date time format (e.g. "mm/dd/yyyy") you specified within the Text function is the same.

     

    I have made a test on my side, please consider modify your whole formula as below (set the DisplayMode property of the button to following😞

    If(
     (Text(datetimevalue, "[$-en-US] dddd", "en-GB") = "Monday" || Text(datetimevalue, "[$-en-US] dddd", "en-GB") = "Thursday") && Text(CCDatePicker.SelectedDate, "[$-en-US] mm/dd/yyyy") = Text(Today()+1,"[$-en-US]mm/dd/yyyy") && Hour(Now()) > 10,
     DisplayMode.View,
     DisplayMode.Edit
    )

     

    Please take a try with above solution, check if the issue is solved.

     

    Best regards,

  • eka24 Profile Picture
    20,925 on at

    @Alfie_Smith 

    Yesterday you marked my reply as a solution, is there any issue with the formula?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 383 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 356

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard