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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / If Date is between 2 D...
Power Apps
Unanswered

If Date is between 2 Dates

(0) ShareShare
ReportReport
Posted on by 308

Hi PowerApps Community,

 

I want a message and a button to display when a user select a date that is between 2 dates. My current code is this:

If(DatePickerStart.SelectedDate >=Date(2020,9,14) && DatePickerStart.SelectedDate <=Date(2020,12,11), Notify("This is a period of high season. You need to aks for approval to complete your request",NotificationType.Warning,2000);UpdateContext({vRequest:true}));

The UpdateContext is for my hidden button to show. The code works fine if I choose a date between the dates. However, if I choose a date that is not bewteen the dates, the Warning message pop up even though it doesn't have to (the button doesn't show). 

 

Can anyone help me?

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @JB0007 

    I made some small changes to your formula.  Please try it out and let  me know if the desired result is produced.

    If(
     DatePickerStart.SelectedDate >=Date(2020,9,14) && DatePickerStart.SelectedDate <=Date(2020,12,11),
     UpdateContext({vRequest:true}),
     Notify("This is a period of high season. You need to aks for approval to complete your request",NotificationType.Warning,2000)
    );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • JB0007 Profile Picture
    308 on at

    Hi @mdevaney thanks for the reply and your help. 

     

    I have insert the year 2020 in the date formula, which means that in 2021 I need to remember to change the year to 2021. However, do you know how can I specify the formula to occur every year instead of keep entering the current year?

     

    If it is also possible, to change the date as: the last 2 weeks of September to the first 2 weeks of December. So that I can insert the formula only 1 time.

     

    Thanks in advance.

     

  • mdevaney Profile Picture
    29,989 Moderator on at

    @JB0007 
    Please post as a new forums question and explain in detail.  I cannot picture what your app looks like.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard