Showing results for 
Search instead for 
Did you mean: 
Helper II
Helper II

How to calculate the difference between two times one from a data source and now.

Hi All,


I've managed to get my clock working but now I'm trying to calculate the time difference between a saved date:time in a table and now.


I have a Table in a Data source titled "EWDData2" with a column titled "Time".


i also have the current time updating in my textbox titled "textbox1".


I'd like to ideally get the difference to show in the text format hh:mm:ss


Here's what I have so far but its not working, hoping you can help.




Thanks in advance for any help you can provide




Helper II
Helper II

Hi All,


I've managed to get a calculation but it doesn't update with the timer.


The calculation that gives a static number is




I have a timer added to textbox1 but even though textbox1 updates DateDiff doesn't.


Also I'd like to have the result shown in hh:mm:ss format but not sure how to do this?


Would really appreciate any help






I would suggest storing the current datetime in a context or global variable instead (also updated by timer).  Much as PowerApps touts the use of text boxes (labels) to store values for further calculations, the implementation is messy.  A lot of PowerApps is messy, I wish more time was spent by the product team in clearing this up than creating new functionality.

Hi Meneghino,


Thanks for all your help so far, you'v been awesome with your assistance. First up your suggetion of using


DateDiff(Last(EWDData2).Time, DateTimeValue(textbox1.Text), Seconds)


didn't work, it didn't ike the text box when it was expecting a value.


I'll try the global variable route when I get a chance.


Cheers and thanks again




Hi @DavidWilson

Not sure why it doesn't work.  Travelling today so a bit difficult, but do reach out tomorrow if you still haven't resolved it.

Hi @DavidWilson,


Calculating date difference would require the two time string in the same date/Time format.

So to make it work, it should be:

DateDiff(DateTimeValue(Last(EWDData2).Time), DateTimeValue(textbox1.Text), Seconds)

By the way, based on what I know, there is no proper function that would convert the time interval into the HH:MM: SS format.


PowerApps would have the Time field from SQL Server displayed in the format below:


See the following thread for more details: SQL Server Time column formatting


If you would like to have a function which would format time interval into HH:MM: SS format, then please consider submit it as an idea, in the following site:




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

Hi Michael,


Sadly that doesn't work either, but I did manage to get it to work using the following.


DateDiff(DateTimeValue(Last(EWDData2).Time), DateTimeValue(textbox1), Seconds)


That formula is to let a driver know how long they have been driving.


I now want to work out how to add a label for a time field in the future from when they started driving.


i.e. If the time stamp for EWDData2 was at 12:00am I'd like to create a label 5 and a half hours from that time as thats the momst hours they are allowed to drive.


I tried this but it didn't work


Text(DateTimeValue(Last(EWDData2).Time) + DateTimeValue(330), Minutes)


Thanksing everyone for your help with this.






Helpful resources

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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (48,183)