cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## Calculate the time between two dates time value

I have a SharePoint List of 5 columns.

1. StartDate(Displaying Date)

2.StartTime(Displaying Time)

3.EndDate(Displaying Date)

4.EndTime(Displaying Time)

5.CourseDuration(Number Type)

So I want to calculate the time between Start Date and End Date. For Example my startdate is 25/10/2019 and end date is 28/11/2019. So I want to calculate the time period in hour between "StartDate (9:00)Am(Start time) to End date (5:00)pm(end time). and display the calculated output in the Course Duration in PowerApps Form edit form control. Please ShareWIth me if any body have idea.

Best Regards,

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support

Hi @Anonymous ,

Try with below formula in the default property of the data card for CourseDuration column:

`Value(DateDiff((DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value), Value(MinuteValue2.Selected.Value), 0)),(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)),Hours))`

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thnq you very much it is working for me. You solved my problem

2 REPLIES 2
Community Support

Hi @Anonymous ,

Try with below formula in the default property of the data card for CourseDuration column:

`Value(DateDiff((DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value), Value(MinuteValue2.Selected.Value), 0)),(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)),Hours))`

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thnq you very much it is working for me. You solved my problem

Announcements

#### Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

#### Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

#### European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

#### Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,367)