cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Responsive Resident
Responsive Resident

Re: Time Display Format

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

11 REPLIES 11
Highlighted
Responsive Resident
Responsive Resident

Re: Time Display Format

show us the code you are using

Did you use the DateDiff?

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

 

Highlighted
Helper I
Helper I

Re: Time Display Format

I'm using this to calculate seconds

(RoundDown((CurrentTime - InitialTime) * 24 * 60 * 60, 0))
Highlighted
Helper I
Helper I

Re: Time Display Format

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

Highlighted
Responsive Resident
Responsive Resident

Re: Time Display Format

CurrentTime & InitialTime are integer values or datetime?
Highlighted
Helper I
Helper I

Re: Time Display Format

are date time values using functions now()

Highlighted
Memorable Member
Memorable Member

Re: Time Display Format

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"

Highlighted
Helper I
Helper I

Re: Time Display Format

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

Highlighted
Memorable Member
Memorable Member

Re: Time Display Format

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
Highlighted
Responsive Resident
Responsive Resident

Re: Time Display Format

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

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,431)