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

## Calculate the difference between two hourly data

Hello, I hope you are having a good day.

I need to know which function allows me to do the following.
I need to know if two values of hour and minute have a difference of 15 minutes between them for example.

20:13 and 19:58 or between 15:59 and 16:14

Thank you very much in advance

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User

Please take another look at the post and note that the date/time strings are converted to integers using the ticks() expression.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Community Support

Has your problem been solved?

If your problem has been solved by Scott's reply, please consider accept his reply as an answer.

I test on my side and you can refer to below screenshots.

Expression:

div(sub(outputs('Compose'),outputs('Compose_2')),600000000)

Result

Best Regards.

5 REPLIES 5
Super User

Please see this post as it explains how to do exactly what you are trying to accomplish.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Frequent Visitor

Thank you very much for your prompt reply. But my data comes as string and the functions explained in that post are of type integer. So I don't know how I can do this, how to convert this string date

``2021-11-30T20:13:00``

to date type date to be able to use this function

``div(div(mul(sub(variables('Aux1'),variables('Aux2')),100),1000000000),60)``
Super User

Please take another look at the post and note that the date/time strings are converted to integers using the ticks() expression.

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Community Support

Has your problem been solved?

If your problem has been solved by Scott's reply, please consider accept his reply as an answer.

I test on my side and you can refer to below screenshots.

Expression:

div(sub(outputs('Compose'),outputs('Compose_2')),600000000)

Result

Best Regards.

Frequent Visitor

Thank you @ScottShearer  and @v-LilyW-msft . My last question, What is the formula to be able to see the difference considering the seconds? Because I have a stream that runs every 5 minutes. It ran at 23:15:33 and the other date I need to know was at 23:14:43, so it falls within the [0-5] minute difference interval. But then I run at 23:20:34 and it takes the date 24:14:43 positive again, when in fact it should no longer take it.

## Helpful resources

Announcements

#### Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

#### Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

#### 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.

#### 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 (2,806)