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

Text Format of Time Equivalent to [h] in Excel for times > 24 hours

Hi. I am using CalcDiff = DateDiff(Time1,Time2,Seconds) to work out the seconds between two Dates.

Then I am using CalcTime = Time(0,0,CalcDiff) to get back to a Time.

From reading prior Forum notes this seems the workaround to get Times between dates.

I then want to format it Text(CalcTime,”[h]:mm”) like I would in Excel as I want to display any hours > 24 as Hours rather than Days and Hours.

But [h] doesn’t seem to be an option.

Can anyone advise is there an equivalent or workaround available in PowerApps?

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-text

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/show-text-dates-times

2 REPLIES 2
MessEngineer
Level: Powered On

Re: Text Format of Time Equivalent to [h] in Excel for times > 24 hours

I can use the following formula if desperate to display in HOUR : MIN : SEC format with it capable of dealing with HOURS > 24.

 

CONCATENATE(TEXT(ROUNDDOWN(TimeSeconds/86400,0)*24+ROUNDDOWN(MOD(TimeSeconds,86400)/3600,0),"0"),":",TEXT(ROUNDDOWN(MOD(TimeSeconds,3600)/60,0),"00"),":",TEXT(ROUNDDOWN(MOD(TimeSeconds,60),0),"00"))

 

But I can't believe this is my only alternative. Especially as I can't see how to build a FUNCTION in PowerApps to pass in the TimeSeconds variable and get the result rather than having to repeat the above formula everywhere?

Highlighted
Lisabel0
Level 8

Re: Text Format of Time Equivalent to [h] in Excel for times > 24 hours

Can you explain with example data? I cannot fully understand what you are trying to achieve.