cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

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

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

 

View solution in original post

3 REPLIES 3
TopShelf-MSFT
Level 10

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

@Anonymous  Moved this thread from News Annoucements to General Forum @TopShelf-MSFT 

Community Support Team
Community Support Team

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

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

 

View solution in original post

TopShelf-MSFT
Level 10

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

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

 

Thank you,

 

@TopShelf-MSFT 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,976)