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()

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

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