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 / Compare Today() or Now...
Power Apps
Unanswered

Compare Today() or Now() against a given date in PowerApps

(0) ShareShare
ReportReport
Posted on by 24

I've seen a lot of threads on this topic, but nothing that really gets at something fundamental that I'm trying to achieve in PowerApps and maybe would help someone else. Here's my example code:

 

 

If(
Today()>10/01/2023 And Today() < 10/01/2024, Set (varFY, "FY2023")
)

 

 

This seems incredibly straightforward but the evaluation fails in a way that doesn't make sense to me.
I'm trying to say that If Today is after 10/01/2023 AND before 10/01/2024 Then the variable should be this.

 

The way this evaluates basically determines Today() (or Now() if I swap that in) to be greater than (and true) no matter what the other static date given is... why?! 

 

Wrapping things in Text() doesn't seem to make a difference. There must be something obvious that I'm missing because this seems like it would be a very straightforward calculation....

Categories:
I have the same question (0)
  • mmollet Profile Picture
    3,187 on at

    If this is the exact code you have in your app then you are missing a closing parethesis at the end. You close the set function but never close the If statement afterwards. This may cause Power Apps to not evaluate those function calls properly. 

    Also no date is after a date that hasn't happened yet which would be the case for any date returned by Today() or Now() until October 2nd. The current year is 2023 so you would need to change 2023 to 2022 and 2024 to 2023 to make this evalue to anything other than false right now.

     

    Basically your formula is If(false And true) which will always evaluate to false. 

  • Verified answer
    DScogna Profile Picture
    24 on at

    Good catch @mmollet - though that wasn't it. I reformatted my code snippit for clarity. Again unless I'm missing something I seem to have resolved (and got the behavior I wanted) with the following:

     

    If( 
    Today()>Date(2022,10,01) And Today()<Date(2023,10,01), Set(varFY, "FY2023")
    )
  • mmollet Profile Picture
    3,187 on at

    Ah yes using the date function is def needed as well as having the correct years of course! Good catch yourself! Teamwork makes the Power Apps work... or whatever they say!

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