Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 4L4gi+EiplNKRHzP3D6ffm
Power Apps - Building Power Apps
Answered

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

Like (0) ShareShare
ReportReport
Posted on 8 Mar 2023 20:05:30 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....

  • mmollet Profile Picture
    3,187 on 08 Mar 2023 at 22:17:23
    Re: Compare Today() or Now() against a given date in PowerApps

    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!

  • Verified answer
    DScogna Profile Picture
    24 on 08 Mar 2023 at 22:02:45
    Re: Compare Today() or Now() against a given date in PowerApps

    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 08 Mar 2023 at 20:21:20
    Re: Compare Today() or Now() against a given date in PowerApps

    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. 

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 20

#2
BCBuizer Profile Picture

BCBuizer 10 Super User 2025 Season 1

#2
LC-26081402-0 Profile Picture

LC-26081402-0 10

Overall leaderboard
Loading started
Loading complete