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

count date (from date) to (to date)

Capture.PNG

2 REPLIES 2
RusselThomas
Microsoft
Microsoft

Hi Raj_Saha,

 

I assume you mean you want to see how many days between the dates?  

 

If my assumption is correct, you may be looking for the DateDiff() function.

 

try this;

DateDiff(DatePicker1.SelectedDate, DatePicker2.SelectedDate,Days)

To avoid negative numbers if the start date is after the end date, you can add some logic; 

If(DateDiff(DatePicker1.SelectedDate, DatePicker2.SelectedDate,Days)<0, 
    DateDiff(DatePicker1.SelectedDate, DatePicker2.SelectedDate,Days)*-1,
    DateDiff(DatePicker1.SelectedDate, DatePicker2.SelectedDate,Days))

You can also use different units (weeks, months, years).

 

Hope this helps

 

RT

v-xida-msft
Community Support
Community Support

Hi @Anonymous,

 

Could you please share a bit more about your scenario?

Do you want to calculate the number of days between the start date and the end date?

 

If you want to calculate the number of days between the start date and the end date, I agree with @RusselThomas's thought almost. Please take a try with the following workaround:8.JPG

 

 

Set Text property of the Label control to following formula:

DateDiff(
DatePicker1.SelectedDate, /* Start Date */
DatePicker2.SelectedDate /* End Date */
)

More details about the DateDiff function in PowerApps, please check the following article:

DateDiff function

 

If you want to exclude weekends (or holidays) between two different dates, please check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/excluding-weekends-and-holidays-in-date-differences-in-powerapps/

 

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (37,953)