November 25, 200619 yr 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!
November 25, 200619 yr 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 November 25, 200619 yr by Guest Corrected Calc - thank you Michael! :^)
November 25, 200619 yr 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. LaRetta
Create an account or sign in to comment