question

HysoreKen-7937 avatar image
0 Votes"
HysoreKen-7937 asked JoyZ commented

Calculate Time Span in Power Automate

I have a SharePoint calendar where I'm entering events with a Start Date and Time and an End Date and Time. I want to take the Start and End and determine the number of hours between the two. I will then enter the number of hours into the event.

I know I need to work with the timespan and most likely get ticks in the formula, but struggling a bit with this one.

Any help would be appreciated.

The info is all being pulled from and entered into a SharePoint calendar and im doing the automation and formulas using power automate

thanks,

office-sharepoint-online
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LeonLaude avatar image
0 Votes"
LeonLaude answered

Hi @HysoreKen-7937,

Please note that Power Automate is currently not supported in the Q&A forums, the supported products are listed over here https://docs.microsoft.com/en-us/answers/products.

You may ask the experts in the dedicated Power Automate forum over here:
https://powerusers.microsoft.com/t5/Microsoft-Power-Automate/ct-p/MPACommunity


If the reply was helpful please don't forget to upvote and/or accept as answer, thank you!


Best regards,
Leon

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JoyZ avatar image
0 Votes"
JoyZ answered JoyZ commented

@HysoreKen-7937,

Please refer to following steps in Power Automate to calculate hours between Start Time and End Time:

107969-image.png

Start Compose:

 ticks(triggerBody()?['EventDate'])

End Compose:

 ticks(triggerBody()?['EndDate'])

DifferenceAshours Compose:

 div(div(mul(sub(outputs('End'),outputs('Start')),100),1000000000),3600)

Result:

108081-image.png

Then you could use DifferenceAshours Compose to update columns in calendar list.

More information:

https://powerusers.microsoft.com/t5/Building-Power-Apps/how-to-get-difference-between-two-dates-in-flow/td-p/283186


If an Answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



image.png (31.6 KiB)
image.png (22.8 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@HysoreKen-7937,

Is there any progress on this issue?

Please feel free to reply.

0 Votes 0 ·

@HysoreKen-7937,

I’m checking how the things are going on about this issue. Whether the post helps you?

You can accept the post as answer if it helps.

Thank you for your understanding and support.

0 Votes 0 ·