cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
OwninJoe
Helper I
Helper I

Compare SharePoint Date and Time to Date field in PowerApps

If i have a date and time column on a SharePoint list, how would i go about extracting the Date for comparison purposes?

 

For example, If the SharePoint column name is 'IncidentDate', how would I extract just the Date field from 'IncidentDate' and compare it to a Date input that I've created on a form?

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @OwninJoe :

Could you tell me :

  • What is "Date input"'s data type?Is it "DataTime"?
  •   Do you only want to compare the date size of'IncidentDate' and'Date input' (not including time)

I assume "Date input"'s data type is "DataTime".

My suggestion is to use DateDiff,for example:

 

 

DateDiff('IncidentDate','Date input',Days)

 

 

In the DateDiff function, if you directly use Days as the calculation unit, the time will be ignored in the calculation.

If the result of the formula is 0:

Then the dates of the two parameters are the same

If the result of the formula < 0:

Then the date of'Date input' is less than the date of'IncidentDate'

If the result of the formula > 0:

Then the date of'Date input' is greater than the date of'IncidentDate'

Best Regards,

Bof

View solution in original post

2 REPLIES 2
eka24
Super User
Super User

You may have to give more details on how the comparison would be done. Is the incident Date on a form?

 On getting the date component of the incident, you can use;

Text(IncidentDate,"dd-mm-yy")

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

v-bofeng-msft
Community Support
Community Support

Hi @OwninJoe :

Could you tell me :

  • What is "Date input"'s data type?Is it "DataTime"?
  •   Do you only want to compare the date size of'IncidentDate' and'Date input' (not including time)

I assume "Date input"'s data type is "DataTime".

My suggestion is to use DateDiff,for example:

 

 

DateDiff('IncidentDate','Date input',Days)

 

 

In the DateDiff function, if you directly use Days as the calculation unit, the time will be ignored in the calculation.

If the result of the formula is 0:

Then the dates of the two parameters are the same

If the result of the formula < 0:

Then the date of'Date input' is less than the date of'IncidentDate'

If the result of the formula > 0:

Then the date of'Date input' is greater than the date of'IncidentDate'

Best Regards,

Bof

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,298)