cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
drallam2
Level: Powered On

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
Level 8

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

9 REPLIES 9
bdodu
Level 8

Re: Time Display Format

show us the code you are using

Did you use the DateDiff?

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

 

drallam2
Level: Powered On

Re: Time Display Format

I'm using this to calculate seconds

(RoundDown((CurrentTime - InitialTime) * 24 * 60 * 60, 0))
drallam2
Level: Powered On

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

bdodu
Level 8

Re: Time Display Format

CurrentTime & InitialTime are integer values or datetime?
drallam2
Level: Powered On

Re: Time Display Format

are date time values using functions now()

Sienna
Level 10

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"

drallam2
Level: Powered On

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

Sienna
Level 10

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
bdodu
Level 8

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 85 members 3,294 guests
Please welcome our newest community members: