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 / Hide button based on d...
Power Apps
Answered

Hide button based on date input

(0) ShareShare
ReportReport
Posted on by 364

Hi all, 

 

I was hoping this would be simple, but I am still struggling to figure it out. I have a button in an app that prevents the user from selecting it if they enter a date more than 1 day in the past. All I need to do, is add the same functionality but this time for days in the future. 

 

An example: A user cannot submit a form if they input the dates (9/18/2021) or (9/22/2021) if they are using the app on (9/20/2021)

 

I am currently using this function to prevent the submit button from being accessed if the selected date is in the past: 

If(DateDiff(DataCardValue18.SelectedDate, Today(),Days) > 1, DisplayMode.Disabled, Edit)

 

If anyone knows how to get the same result for future dates, please let me know!

Categories:
I have the same question (0)
  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    This will work for DateDiff generating a negative number of days too:

     

    If(Abs(DateDiff(DataCardValue18.SelectedDate, Today(),Days)) > 1, DisplayMode.Disabled, DisplayMode.Edit)

     

    Hope that helps,

    Bryan

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 545 Most Valuable Professional

#2
Haque Profile Picture

Haque 314

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard