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 / How to compare a today...
Power Apps
Answered

How to compare a today date with value in the text box date data

(0) ShareShare
ReportReport
Posted on by 2

My Textbox value property is :

Text(ThisItem.SSRDate,"dd-mm-yyyy"
 
To change a color of rectangle background, on the fill property I am trying to use the below code :
If(BaseDataText_15<Today(),Color.Red,Color.Blue)
I want to be red background if the date has crossed today's date 
 
Getting error 
MIA27_0-1712473030014.png

 

 

Please guide

 

Categories:
I have the same question (0)
  • Verified answer
    Ramanachiappan Profile Picture
    179 Moderator on at

    Hi @MIA27 , 

    Typically, when comparing dates in PowerApps, it's essential to ensure the correct data type is used. Therefore, you should utilize this approach.

    If(DateValue(BaseDataText_15.Text)<Today(),Color.Red,Color.Blue) 

     

    Best regards, 
    Ramanachiappan M

     

    If my response was helpful, please select "Accept as solution" to close the item. Your thumbs up would be highly appreciated if you found it useful. Thank you!

     

     

  • Verified answer
    Static Profile Picture
    118 on at

    HI @Ramanachiappan ,

    Try something like this
    If( DateValue(Text(ThisItem.SSRDate, "dd-mm-yyyy")) < Today(), Color.Red, Color.Blue )
    1. Text(ThisItem.SSRDate, "dd-mm-yyyy"): This extracts the date value from the text box and formats it as a string in the "dd-mm-yyyy" format.

    2. DateValue(...): This converts the formatted date string into a date value that can be compared.

    3. Today(): This function retrieves the current date

    4. We compare the extracted date value from the text box with today's date using the < operator.

    5. If the date in the text box is earlier than today's date, the rectangle fill color will be set to red (Color.Red); otherwise, it will be set to blue (Color.Blue).

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 93 Most Valuable Professional

#2
Haque Profile Picture

Haque 81

#3
Valantis Profile Picture

Valantis 49

Last 30 days Overall leaderboard