Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Convert Hours Into Days

Featured Replies

I have been wondering on where to start with this. Any help is appreciated.

I have a calculation that returns the time a record was last updated but it is in hours. How can I convert it to days:

My calculated result: 25:14:01

Desired result: 1 Day, 1 Hour, 14 Minutes

Thanks!

There may be easier ways but this works:

Let ( [

d = Div ( theTime ; 86400 ) ;

t = Mod ( theTime ; 86400 ) ;

h = Hour ( t ) ;

m = Minute ( t ) ;

s = Seconds ( t )

] ;

If ( d ; d & " Day" & If ( d > 1 ; "s" ) ) &

If ( h ; ", " & h & " Hour" & If ( h > 1 ; "s" ) ) &

If ( m ; ", " & m & " Minute" & If ( m > 1 ; "s" ) ) &

If ( s ; ", " & s & " Second" & If ( s > 1 ; "s" ) )

)

UPDATE: Corrected calc on t line. I had t = Mod ( theTime ; d * 86400 ) which was redundant. All I needed was 86400. :)

Edited by Guest
Corrected Calc - thank you Michael! :^)

I re-wrote the calc. If there was no days then it was producing the comma before the hours. This works no matter what:

Let ( [

d = Div ( theTime ; 86400 ) ;

t = Mod ( theTime ; 86400 ) ;

h = Hour ( t ) ;

m = Minute ( t ) ;

s = Seconds ( t )

] ;

If ( d ; d & " Day" & If ( d > 1 ; "s" ) & If ( h or m or s ; ", " ) ) &

If ( h ; h & " Hour" & If ( h > 1 ; "s" ) & If ( m or s ; ", " ) ) &

If ( m ; m & " Minute" & If ( m > 1 ; "s" ) & If ( s ; ", " ) ) &

If ( s ; s & " Second" & If ( s > 1 ; "s" ) )

)

I must remember to extend the same theory through an entire calc or it can bite me somewhere. :wink2:

LaRetta

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.