cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
drallam2
Helper I
Helper I

Time Display Format

Hi,

 

I'm having trouble with converting seconds to hh:mm:ss format in a text display.

I'm calculating the seconds based on the difference between two time stamps.

anyhelp will be great!

1 ACCEPTED SOLUTION

Accepted Solutions
bdodu
Responsive Resident
Responsive Resident

Try this:

 

Text(RoundDown(DateDiff(CurrentTime,InitialTime,Seconds)/3600,0),"00")&":"&
Text(If(RoundDown(DateDiff(CurrentTime,InitialTime,Seconds)/60,0)>59,0,RoundDown(DateDiff(CurrentTime,InitialTime,Seconds)/60,0)),"00")&":"&
Text(Mod(DateDiff(CurrentTime,InitialTime,Seconds),60),"00")

 

View solution in original post

13 REPLIES 13
bdodu
Responsive Resident
Responsive Resident

show us the code you are using

Did you use the DateDiff?

Text(DateDiff(StartTime1,EndTime1,Seconds),"hh:mm:ss")

 

I'm using this to calculate seconds

(RoundDown((CurrentTime - InitialTime) * 24 * 60 * 60, 0))

Also The hh:mm:ss format doesn't work. I want to see the result like this.
Eg: we have320 seconds the result should be 00h:05m:20s

bdodu
Responsive Resident
Responsive Resident

CurrentTime & InitialTime are integer values or datetime?

are date time values using functions now()

Sienna
Resident Rockstar
Resident Rockstar

Hi @drallam2

Do not use

 

(RoundDown((CurrentTime - InitialTime) * 24 * 60 * 60, 0))

  Use DateDiff to get seconds difference

 

DateDiff(InitialTime,CurrentTime,Seconds)

 

To get it to a format 00h:05m:20s you will have to be little more creative

 

Text(DateAdd(CurrentTime, DateDiff(CurrentTime,InitialTime,Seconds), Seconds),"hh") & "h:"
& Text(DateAdd(CurrentTime, DateDiff(CurrentTime,InitialTime,Seconds), Seconds),"mm") & "m:"
& Text(DateAdd(CurrentTime, DateDiff(CurrentTime,InitialTime,Seconds), Seconds),"ss") & "s"

Unfortunately. I'm not getting the same result. Example for a 2 second elapsed time. For some reason the time shows 9h:59m:58s

Sienna
Resident Rockstar
Resident Rockstar

Display CurrentTime and InitialTime in a labels and see what you get. Are the times correct? If not how do you set the currentTime and InitialTime
bdodu
Responsive Resident
Responsive Resident

Try this:

 

Text(RoundDown(DateDiff(CurrentTime,InitialTime,Seconds)/3600,0),"00")&":"&
Text(If(RoundDown(DateDiff(CurrentTime,InitialTime,Seconds)/60,0)>59,0,RoundDown(DateDiff(CurrentTime,InitialTime,Seconds)/60,0)),"00")&":"&
Text(Mod(DateDiff(CurrentTime,InitialTime,Seconds),60),"00")

 

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (4,203)