cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pracmt1515
Frequent Visitor

Problem calculating the duration whit Date Diff

 

Hello im using an excel file stored on one drive,

So im calculating in my app the duration of some activities where i can put the initial date and the end date of the activity, and im using Date diff  to calculate the duration of the activity,

So for example the initial date was 00:00:00 and the final date was 00:10:00 so the duration will be 10 minutes or 0,167 hours (ill leave a pic of the problem down there), so far so good the app shows me the 0,167 value as a duration, but when i save that and check the excel file on one drive, the duration appears like 167, which clearly is the incorrect value, it is like the app or something is multiplying by 1000 at some point .

im using a datacard whit the function:  Value(Round((DateDiff(TimeValue(HoraInicio.Text);TimeValue(HoraFin.Text);Minutes)/60);3);"es-ES"))

where: 

Hora inicio is the initial date in hours,
Hora Fin is the final date in hours, 

Duración.PNG

pppp.PNG

 

 

Ill appreciate some help,

Stay safe out there. 

 

4 REPLIES 4
VijayTailor
Resident Rockstar
Resident Rockstar

Hi @pracmt1515 ,

For this Requirment.

You need to change the Formatting For Excel Field that resides in Onedrive Excel Table.
Basically, PowerAPp Pass the correct data but this value change on the excel side.

please change the Excel Column Formatting to Text or something else that fits your requirement.

Thanks,
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

I try it but it didn't work, im thinking that the problem may be that the number is too small so excel confuses the coma whit a dot, and that changes the value of 0,167 to 167,

¿what do you think?, maybe a solution for that is to put the duration in minutes and not in hours.

Hi @pracmt1515 ,

Change the Excel Column Formate as Text.

VijayTailor_0-1602192912574.png


And Pass the value a text from Power App.
Thanks,
Hope to help you to resolve your Issue

Thanks ill let you know if it works, 

Stay safe!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,312)