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 two dat...
Power Apps
Answered

How to compare two date field values on click of submit button in PowerApp

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello All,

I would like to apply the validation on click of submit button and I need to compare the two date field values.

 

Can anyone help me with this?

 

Any help would be appreciated.

Thank you in advance.

Categories:
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Anonymous  Moved this thread from News Annoucements to General Forum @Anonymous 

  • Verified answer
    v-yuxima-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Could you please share more of your requirements?

    Do you want to compare the two data values when you click submit button?

    I think you can use datediff function to help you achieve that. I test as next:

    Data Source:

    20190514DateCompareDataSource.PNG

     

    App Test:

    Add one label control,and rename it as Label_Message.

    Icon1(Submit).OnSelect=If(DateDiff(DataCardValue5.SelectedDate, DataCardValue4.SelectedDate )>0,SubmitForm(Form1))

    Label_Message.Text="You input DateEnd<DateStart,please input again!"

    Label_Message.Visible=DateDiff(DataCardValue5.SelectedDate, DataCardValue4.SelectedDate )<0

    Label_Message.Color=Red

    20190514DateCompareAppTest.PNG

     

    Hope this could be helpful.

     

    Best Regards.

    Yumia

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for posting in the community @Anonymous - can you review the above reply and update the thread if it was helpful? 

     

    Thank you,

     

    @Anonymous 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard