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
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.
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
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.
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:
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.
Check out the on demand sessions that are available now!
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Features releasing from October 2020 through March 2021
Check out the Power Platform Community Highlights